Merge pull request #5903 from electron/update-target-url

Add update-target-url event
This commit is contained in:
Cheng Zhao 2016-06-07 07:10:54 +00:00 committed by GitHub
commit d3d2ca9a31
6 changed files with 30 additions and 5 deletions

View file

@ -389,6 +389,11 @@ void WebContents::ActivateContents(content::WebContents* source) {
Emit("activate");
}
void WebContents::UpdateTargetURL(content::WebContents* source,
const GURL& url) {
Emit("update-target-url", url);
}
bool WebContents::IsPopupOrPanel(const content::WebContents* source) const {
return type_ == BROWSER_WINDOW;
}

View file

@ -182,6 +182,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
const gfx::Rect& pos) override;
void CloseContents(content::WebContents* source) override;
void ActivateContents(content::WebContents* contents) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool IsPopupOrPanel(const content::WebContents* source) const override;
void HandleKeyboardEvent(
content::WebContents* source,

View file

@ -288,6 +288,15 @@ a meta tag:
<meta name='theme-color' content='#ff0000'>
```
### Event: 'update-target-url'
Returns:
* `event` Event
* `url` String
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
### Event: 'cursor-changed'
Returns:

View file

@ -782,6 +782,14 @@ Emitted when a page's theme color changes. This is usually due to encountering a
<meta name='theme-color' content='#ff0000'>
```
### Event: 'update-target-url'
Returns:
* `url` String
Emitted when mouse moves over a link or the keyboard moves the focus to a link.
### Event: 'devtools-opened'
Emitted when DevTools is opened.

View file

@ -36,7 +36,8 @@ var supportedWebViewEvents = [
'media-started-playing',
'media-paused',
'found-in-page',
'did-change-theme-color'
'did-change-theme-color',
'update-target-url'
]
var nextInstanceId = 0

View file

@ -27,15 +27,16 @@ var WEB_VIEW_EVENTS = {
'crashed': [],
'gpu-crashed': [],
'plugin-crashed': ['name', 'version'],
'media-started-playing': [],
'media-paused': [],
'did-change-theme-color': ['themeColor'],
'destroyed': [],
'page-title-updated': ['title', 'explicitSet'],
'page-favicon-updated': ['favicons'],
'enter-html-full-screen': [],
'leave-html-full-screen': [],
'found-in-page': ['result']
'media-started-playing': [],
'media-paused': [],
'found-in-page': ['result'],
'did-change-theme-color': ['themeColor'],
'update-target-url': ['url']
}
var DEPRECATED_EVENTS = {