From 2fbe06a2a559a853dcba5bc6e6cfbe5d5a3c12a1 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 12 Apr 2016 16:36:12 +0900 Subject: [PATCH] Handle the Page.reload command coming from devtools --- atom/browser/api/atom_api_web_contents.cc | 4 ++++ atom/browser/api/atom_api_web_contents.h | 3 +++ lib/browser/api/web-contents.js | 6 ++++++ vendor/brightray | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index f8f8add95aac..985c541a15a9 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -635,6 +635,10 @@ void WebContents::DidUpdateFaviconURL( Emit("page-favicon-updated", unique_urls); } +void WebContents::DevToolsReloadPage() { + Emit("devtools-reload-page"); +} + void WebContents::DevToolsFocused() { Emit("devtools-focused"); } diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index ee5a25b26660..0cb2a348e170 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -251,6 +251,9 @@ class WebContents : public mate::TrackableObject, void MediaStoppedPlaying(const MediaPlayerId& id) override; void DidChangeThemeColor(SkColor theme_color) override; + // brightray::InspectableWebContentsDelegate: + void DevToolsReloadPage() override; + // brightray::InspectableWebContentsViewDelegate: void DevToolsFocused() override; void DevToolsOpened() override; diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index 2ec7c14bae11..bc32161e77e7 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -155,6 +155,11 @@ let wrapWebContents = function (webContents) { }) }) + // The devtools requests the webContents to reload. + webContents.on('devtools-reload-page', function () { + webContents.reload() + }) + // Delays the page-title-updated event to next tick. webContents.on('-page-title-updated', function (...args) { setImmediate(() => { @@ -168,6 +173,7 @@ let wrapWebContents = function (webContents) { deprecate.event(webContents, 'page-title-set', 'page-title-updated', function (...args) { return this.emit.apply(this, ['page-title-set'].concat(args)) }) + webContents.printToPDF = function (options, callback) { var printingSetting printingSetting = { diff --git a/vendor/brightray b/vendor/brightray index f7fa7efc2879..cedb11316627 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit f7fa7efc28798bddd302ef5849a74c8bef164347 +Subproject commit cedb11316627ac0e01a5dcd38e75bd1c5a6afa17