From cf14f0922827f1c28a8101746f39c25a6d3f7298 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 22 May 2013 16:57:32 -0400 Subject: [PATCH] Stub out InspectableWebContentsViewWin This class doesn't implement any devtools behavior yet. Right now it's just a glorified wrapper around a content::WebContents. But it's enough to show web content on screen on Windows! --- brightray/brightray.gyp | 2 ++ .../browser/inspectable_web_contents_impl.cc | 2 -- .../win/inspectable_web_contents_view_win.cc | 34 +++++++++++++++++++ .../win/inspectable_web_contents_view_win.h | 33 ++++++++++++++++++ 4 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 brightray/browser/win/inspectable_web_contents_view_win.cc create mode 100644 brightray/browser/win/inspectable_web_contents_view_win.h diff --git a/brightray/brightray.gyp b/brightray/brightray.gyp index 2732d5c9a1dd..e8adbc15fcc4 100644 --- a/brightray/brightray.gyp +++ b/brightray/brightray.gyp @@ -50,6 +50,8 @@ 'browser/notification_presenter_mac.mm', 'browser/url_request_context_getter.cc', 'browser/url_request_context_getter.h', + 'browser/win/inspectable_web_contents_view_win.cc', + 'browser/win/inspectable_web_contents_view_win.h', 'common/application_info.h', 'common/application_info_mac.mm', 'common/application_info_win.cc', diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index c6c6f00f4cd5..7f694ad54ff5 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -41,9 +41,7 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(content::WebContents* web auto context = static_cast(web_contents_->GetBrowserContext()); dock_side_ = context->prefs()->GetString(kDockSidePref); -#if defined(OS_MACOSX) view_.reset(CreateInspectableContentsView(this)); -#endif } InspectableWebContentsImpl::~InspectableWebContentsImpl() { diff --git a/brightray/browser/win/inspectable_web_contents_view_win.cc b/brightray/browser/win/inspectable_web_contents_view_win.cc new file mode 100644 index 000000000000..deab04590c09 --- /dev/null +++ b/brightray/browser/win/inspectable_web_contents_view_win.cc @@ -0,0 +1,34 @@ +#include "browser/win/inspectable_web_contents_view_win.h" + +#include "browser/inspectable_web_contents_impl.h" + +#include "content/public/browser/web_contents_view.h" + +namespace brightray { + +InspectableWebContentsView* CreateInspectableContentsView(InspectableWebContentsImpl* inspectable_web_contents) { + return new InspectableWebContentsViewWin(inspectable_web_contents); +} + +InspectableWebContentsViewWin::InspectableWebContentsViewWin(InspectableWebContentsImpl* inspectable_web_contents) + : inspectable_web_contents_(inspectable_web_contents) { +} + +InspectableWebContentsViewWin::~InspectableWebContentsViewWin() { +} + +gfx::NativeView InspectableWebContentsViewWin::GetNativeView() const { + return inspectable_web_contents_->GetWebContents()->GetView()->GetNativeView(); +} + +void InspectableWebContentsViewWin::ShowDevTools() { +} + +void InspectableWebContentsViewWin::CloseDevTools() { +} + +bool InspectableWebContentsViewWin::SetDockSide(const std::string& side) { + return false; +} + +} diff --git a/brightray/browser/win/inspectable_web_contents_view_win.h b/brightray/browser/win/inspectable_web_contents_view_win.h new file mode 100644 index 000000000000..801eb931360c --- /dev/null +++ b/brightray/browser/win/inspectable_web_contents_view_win.h @@ -0,0 +1,33 @@ +#ifndef BRIGHTRAY_BROWSER_WIN_INSPECTABLE_WEB_CONTENTS_VIEW_WIN_H_ +#define BRIGHTRAY_BROWSER_WIN_INSPECTABLE_WEB_CONTENTS_VIEW_WIN_H_ + +#include "browser/inspectable_web_contents_view.h" + +#include "base/compiler_specific.h" + +namespace brightray { + +class InspectableWebContentsImpl; + +class InspectableWebContentsViewWin : public InspectableWebContentsView { +public: + InspectableWebContentsViewWin(InspectableWebContentsImpl*); + ~InspectableWebContentsViewWin(); + + virtual gfx::NativeView GetNativeView() const OVERRIDE; + virtual void ShowDevTools() OVERRIDE; + virtual void CloseDevTools() OVERRIDE; + virtual bool SetDockSide(const std::string& side) OVERRIDE; + + InspectableWebContentsImpl* inspectable_web_contents() { return inspectable_web_contents_; } + +private: + // Owns us. + InspectableWebContentsImpl* inspectable_web_contents_; + + DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsViewWin); +}; + +} + +#endif