diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index ac96a64d494..02ac372f876 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -109,7 +109,8 @@ content::ServiceWorkerContext* GetServiceWorkerContext( } // namespace WebContents::WebContents(content::WebContents* web_contents) - : content::WebContentsObserver(web_contents), + : CommonWebContentsDelegate(false), + content::WebContentsObserver(web_contents), guest_instance_id_(-1), guest_opaque_(true), guest_host_(nullptr), @@ -118,7 +119,8 @@ WebContents::WebContents(content::WebContents* web_contents) } WebContents::WebContents(const mate::Dictionary& options) - : guest_instance_id_(-1), + : CommonWebContentsDelegate(true), + guest_instance_id_(-1), guest_opaque_(true), guest_host_(nullptr), auto_size_enabled_(false), diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 14de69fc903..97a433ed36c 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -9,7 +9,7 @@ #include #include "atom/browser/api/event_emitter.h" -#include "brightray/browser/default_web_contents_delegate.h" +#include "atom/browser/common_web_contents_delegate.h" #include "content/public/browser/browser_plugin_guest_delegate.h" #include "content/public/common/favicon_url.h" #include "content/public/browser/web_contents_delegate.h" @@ -51,7 +51,7 @@ struct SetSizeParams { class WebContents : public mate::EventEmitter, public content::BrowserPluginGuestDelegate, - public brightray::DefaultWebContentsDelegate, + public CommonWebContentsDelegate, public content::WebContentsObserver, public content::GpuDataManagerObserver { public: diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc new file mode 100644 index 00000000000..46e872384f0 --- /dev/null +++ b/atom/browser/common_web_contents_delegate.cc @@ -0,0 +1,16 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/browser/common_web_contents_delegate.h" + +namespace atom { + +CommonWebContentsDelegate::CommonWebContentsDelegate(bool is_guest) + : is_guest_(is_guest) { +} + +CommonWebContentsDelegate::~CommonWebContentsDelegate() { +} + +} // namespace atom diff --git a/atom/browser/common_web_contents_delegate.h b/atom/browser/common_web_contents_delegate.h new file mode 100644 index 00000000000..f449bf23b9b --- /dev/null +++ b/atom/browser/common_web_contents_delegate.h @@ -0,0 +1,27 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_COMMON_WEB_CONTENTS_DELEGATE_H_ +#define ATOM_BROWSER_COMMON_WEB_CONTENTS_DELEGATE_H_ + +#include "brightray/browser/default_web_contents_delegate.h" + +namespace atom { + +class CommonWebContentsDelegate : public brightray::DefaultWebContentsDelegate { + public: + explicit CommonWebContentsDelegate(bool is_guest); + virtual ~CommonWebContentsDelegate(); + + bool is_guest() const { return is_guest_; }; + + private: + const bool is_guest_; + + DISALLOW_COPY_AND_ASSIGN(CommonWebContentsDelegate); +}; + +} // namespace atom + +#endif // ATOM_BROWSER_COMMON_WEB_CONTENTS_DELEGATE_H_ diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index c254ed96042..6c11e97e96a 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -151,7 +151,8 @@ base::DictionaryValue* CreateFileSystemValue( NativeWindow::NativeWindow(content::WebContents* web_contents, const mate::Dictionary& options) - : content::WebContentsObserver(web_contents), + : CommonWebContentsDelegate(false), + content::WebContentsObserver(web_contents), has_frame_(true), transparent_(false), enable_larger_than_screen_(false), diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index fb614bad2bd..2cfbe135ef6 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -9,13 +9,13 @@ #include #include +#include "atom/browser/common_web_contents_delegate.h" #include "atom/browser/native_window_observer.h" #include "atom/browser/ui/accelerator_util.h" #include "base/cancelable_callback.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "brightray/browser/default_web_contents_delegate.h" #include "brightray/browser/inspectable_web_contents_delegate.h" #include "brightray/browser/inspectable_web_contents_impl.h" #include "content/public/browser/notification_registrar.h" @@ -54,7 +54,7 @@ class AtomJavaScriptDialogManager; struct DraggableRegion; class WebDialogHelper; -class NativeWindow : public brightray::DefaultWebContentsDelegate, +class NativeWindow : public CommonWebContentsDelegate, public brightray::InspectableWebContentsDelegate, public content::WebContentsObserver, public content::NotificationObserver { diff --git a/filenames.gypi b/filenames.gypi index 2bef3883254..6ece2ba634c 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -123,6 +123,8 @@ 'atom/browser/browser_mac.mm', 'atom/browser/browser_win.cc', 'atom/browser/browser_observer.h', + 'atom/browser/common_web_contents_delegate.cc', + 'atom/browser/common_web_contents_delegate.h', 'atom/browser/javascript_environment.cc', 'atom/browser/javascript_environment.h', 'atom/browser/mac/atom_application.h',