Add update-target-url event

This commit is contained in:
Cheng Zhao 2016-06-07 15:56:19 +09:00
parent 1c504ec45d
commit 3c873736d7
6 changed files with 30 additions and 5 deletions

View file

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

View file

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

View file

@ -288,6 +288,15 @@ a meta tag:
<meta name='theme-color' content='#ff0000'> <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' ### Event: 'cursor-changed'
Returns: 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'> <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' ### Event: 'devtools-opened'
Emitted when DevTools is opened. Emitted when DevTools is opened.

View file

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

View file

@ -27,15 +27,16 @@ var WEB_VIEW_EVENTS = {
'crashed': [], 'crashed': [],
'gpu-crashed': [], 'gpu-crashed': [],
'plugin-crashed': ['name', 'version'], 'plugin-crashed': ['name', 'version'],
'media-started-playing': [],
'media-paused': [],
'did-change-theme-color': ['themeColor'],
'destroyed': [], 'destroyed': [],
'page-title-updated': ['title', 'explicitSet'], 'page-title-updated': ['title', 'explicitSet'],
'page-favicon-updated': ['favicons'], 'page-favicon-updated': ['favicons'],
'enter-html-full-screen': [], 'enter-html-full-screen': [],
'leave-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 = { var DEPRECATED_EVENTS = {