From c58bf15345bf990a739c96ec44efbcc19190f2fb Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 9 Sep 2014 17:54:37 +0800 Subject: [PATCH 1/2] mac: Send focus/blur event to devtools web contents. --- .../mac/bry_inspectable_web_contents_view.mm | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/brightray/browser/mac/bry_inspectable_web_contents_view.mm b/brightray/browser/mac/bry_inspectable_web_contents_view.mm index 0fa06f2077d3..4db0d8ac050f 100644 --- a/brightray/browser/mac/bry_inspectable_web_contents_view.mm +++ b/brightray/browser/mac/bry_inspectable_web_contents_view.mm @@ -148,4 +148,30 @@ using namespace brightray; inspectableWebContentsView_->inspectable_web_contents()->CloseDevTools(); } +- (void)windowDidBecomeMain:(NSNotification*)notification { + content::WebContents* web_contents = + inspectableWebContentsView_->inspectable_web_contents()->devtools_web_contents(); + if (!web_contents) + return; + + web_contents->RestoreFocus(); + + content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView(); + if (rwhv) + rwhv->SetActive(true); +} + +- (void)windowDidResignMain:(NSNotification*)notification { + content::WebContents* web_contents = + inspectableWebContentsView_->inspectable_web_contents()->devtools_web_contents(); + if (!web_contents) + return; + + web_contents->StoreFocus(); + + content::RenderWidgetHostView* rwhv = web_contents->GetRenderWidgetHostView(); + if (rwhv) + rwhv->SetActive(false); +} + @end From 30025fe6efa40c661fd0eb011cf4b3f3c26992cc Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 9 Sep 2014 18:28:02 +0800 Subject: [PATCH 2/2] Set toolbar color for devtools. --- brightray/browser/inspectable_web_contents_impl.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 94b1069ebfab..2cb8aba6defe 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -36,7 +36,9 @@ const double kPresetZoomFactors[] = { 0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1.0, const char kDevToolsScheme[] = "chrome-devtools"; const char kDevToolsHost[] = "devtools"; const char kChromeUIDevToolsURL[] = "chrome-devtools://devtools/devtools.html?" - "can_dock=true&&" + "can_dock=true&" + "toolbarColor=rgba(223,223,223,1)&" + "textColor=rgba(0,0,0,1)&" "experiments=true"; const char kDevToolsBoundsPref[] = "brightray.devtools.bounds";