diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index f4f594a2f..00a229461 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -67,6 +67,7 @@ #include "third_party/WebKit/public/web/WebInputEvent.h" #include "third_party/WebKit/public/web/WebFindOptions.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/gfx/screen.h" #include "atom/common/node_includes.h" @@ -493,7 +494,16 @@ void WebContents::ActivateContents(content::WebContents* source) { void WebContents::UpdateTargetURL(content::WebContents* source, const GURL& url) { - Emit("update-target-url", url); + const gfx::Point& location = gfx::Screen::GetScreen()->GetCursorScreenPoint(); + const gfx::Rect& bounds = web_contents()->GetContainerBounds(); + int x = location.x() - bounds.x(); + int y = location.y() - bounds.y(); + Emit("update-target-url", url, x, y); +} + +void WebContents::LoadProgressChanged(content::WebContents* source, + double progress) { + Emit("load-progress-changed", progress); } bool WebContents::IsPopupOrPanel(const content::WebContents* source) const { diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 32c51063b..a51fdcd36 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -232,6 +232,8 @@ class WebContents : public mate::TrackableObject, void CloseContents(content::WebContents* source) override; void ActivateContents(content::WebContents* contents) override; void UpdateTargetURL(content::WebContents* source, const GURL& url) override; + void LoadProgressChanged(content::WebContents* source, + double progress) override; bool IsPopupOrPanel(const content::WebContents* source) const override; void HandleKeyboardEvent( content::WebContents* source, diff --git a/lib/browser/guest-view-manager.js b/lib/browser/guest-view-manager.js index 565573196..4cbce9825 100644 --- a/lib/browser/guest-view-manager.js +++ b/lib/browser/guest-view-manager.js @@ -45,6 +45,7 @@ let supportedWebViewEvents = [ 'found-in-page', 'did-change-theme-color', 'update-target-url', + 'load-progress-changed', 'set-active', 'context-menu' ] diff --git a/lib/renderer/web-view/guest-view-internal.js b/lib/renderer/web-view/guest-view-internal.js index 26c672fe2..a9d8589af 100644 --- a/lib/renderer/web-view/guest-view-internal.js +++ b/lib/renderer/web-view/guest-view-internal.js @@ -41,7 +41,8 @@ var WEB_VIEW_EVENTS = { 'media-paused': [], 'found-in-page': ['result'], 'did-change-theme-color': ['themeColor'], - 'update-target-url': ['url'], + 'update-target-url': ['url', 'x', 'y'], + 'load-progress-changed': ['progress'], 'set-active': ['active'], 'context-menu': ['params'] }