win: Implement attached devtools, fixes #373.

This commit is contained in:
Cheng Zhao 2014-06-11 09:13:55 +08:00
parent 444fe8bf1f
commit 4aa217970e
3 changed files with 11 additions and 7 deletions

View 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 {

View file

@ -16,13 +16,13 @@
#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_;

2
vendor/brightray vendored

@ -1 +1 @@
Subproject commit ab818b4aa2d77441203bd30c0e789e5e69529728
Subproject commit e6db5b381b2d5f721ab3de3fa9b811e112a18b12