Add update-target-url event
authorCheng Zhao <zcbenz@gmail.com>
Tue, 7 Jun 2016 06:56:19 +0000 (15:56 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 7 Jun 2016 06:56:19 +0000 (15:56 +0900)
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h
docs/api/web-contents.md
docs/api/web-view-tag.md
lib/browser/guest-view-manager.js
lib/renderer/web-view/guest-view-internal.js

index 9d93d98..c33b9f1 100644 (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;
 }
index 85c43f1..dfaac87 100644 (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,
index c3f1f82..b9ff9d7 100644 (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:
index f99bb4f..d00f64d 100644 (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.
index 6876a8d..c5c075b 100644 (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
index 7432444..c4741fc 100644 (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 = {