win: Implement attached devtools, fixes #373.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 11 Jun 2014 01:13:55 +0000 (09:13 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 11 Jun 2014 03:03:10 +0000 (11:03 +0800)
atom/browser/native_window_win.cc
atom/browser/native_window_win.h
vendor/brightray

index 8682dc0..f78a3fe 100644 (file)
@@ -21,7 +21,6 @@
 #include "content/public/browser/web_contents_view.h"
 #include "ui/gfx/path.h"
 #include "ui/base/models/simple_menu_model.h"
-#include "ui/views/controls/webview/webview.h"
 #include "ui/views/widget/widget.h"
 #include "ui/views/widget/native_widget_win.h"
 #include "ui/views/window/client_view.h"
@@ -218,7 +217,7 @@ NativeWindowWin::NativeWindowWin(content::WebContents* web_contents,
                                  base::DictionaryValue* options)
     : NativeWindow(web_contents, options),
       window_(new views::Widget),
-      web_view_(new views::WebView(NULL)),
+      web_view_(inspectable_web_contents_view()->GetView()),
       use_content_size_(false),
       resizable_(true) {
   options->GetBoolean(switches::kResizable, &resizable_);
@@ -245,7 +244,6 @@ NativeWindowWin::NativeWindowWin(content::WebContents* web_contents,
   window_->CenterWindow(size);
   window_->UpdateWindowIcon();
 
-  web_view_->SetWebContents(web_contents);
   OnViewWasResized();
 }
 
@@ -494,7 +492,7 @@ void NativeWindowWin::DeleteDelegate() {
 }
 
 views::View* NativeWindowWin::GetInitiallyFocusedView() {
-  return web_view_;
+  return inspectable_web_contents_view()->GetWebView();
 }
 
 bool NativeWindowWin::CanResize() const {
index 8d25fcb..9d34098 100644 (file)
 #include "ui/gfx/size.h"
 #include "ui/views/focus/widget_focus_manager.h"
 #include "ui/views/widget/widget_delegate.h"
+#include "vendor/brightray/browser/win/inspectable_web_contents_view_win.h"
 
 namespace ui {
 class MenuModel;
 }
 
 namespace views {
-class WebView;
 class Widget;
 }
 
@@ -80,6 +80,12 @@ class NativeWindowWin : public NativeWindow,
   // Set the native window menu.
   void SetMenu(ui::MenuModel* menu_model);
 
+  brightray::InspectableWebContentsViewWin* inspectable_web_contents_view()
+      const {
+    return static_cast<brightray::InspectableWebContentsViewWin*>(
+        inspectable_web_contents()->GetView());
+  }
+
   views::Widget* window() const { return window_.get(); }
   atom::Menu2* menu() const { return menu_.get(); }
   SkRegion* draggable_region() { return draggable_region_.get(); }
@@ -130,7 +136,7 @@ class NativeWindowWin : public NativeWindow,
   void RegisterAccelerators();
 
   scoped_ptr<views::Widget> window_;
-  views::WebView* web_view_;  // managed by window_.
+  views::View* web_view_;  // managed by window_.
 
   // The window menu.
   scoped_ptr<atom::Menu2> menu_;
index ab818b4..e6db5b3 160000 (submodule)
@@ -1 +1 @@
-Subproject commit ab818b4aa2d77441203bd30c0e789e5e69529728
+Subproject commit e6db5b381b2d5f721ab3de3fa9b811e112a18b12