From 4ae52721c45bde809183b55628267042b92bbb92 Mon Sep 17 00:00:00 2001 From: Robo Date: Tue, 31 Mar 2015 21:17:28 +0530 Subject: [PATCH] detecting focus on devtools webcontents --- brightray/browser/inspectable_web_contents_delegate.h | 1 + brightray/browser/inspectable_web_contents_impl.cc | 6 ++++++ brightray/browser/inspectable_web_contents_impl.h | 1 + 3 files changed, 8 insertions(+) diff --git a/brightray/browser/inspectable_web_contents_delegate.h b/brightray/browser/inspectable_web_contents_delegate.h index 082343f2f6..d32b139ba9 100644 --- a/brightray/browser/inspectable_web_contents_delegate.h +++ b/brightray/browser/inspectable_web_contents_delegate.h @@ -19,6 +19,7 @@ class InspectableWebContentsDelegate { const std::string& url, const std::string& content, bool save_as) {} virtual void DevToolsAppendToFile( const std::string& url, const std::string& content) {} + virtual void DevToolsFocused() {} #if defined(USE_X11) // Called when creating devtools window. diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index 88ed18dc1f..9def5ad863 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -241,6 +241,12 @@ void InspectableWebContentsImpl::AppendToFile( delegate_->DevToolsAppendToFile(url, content); } +void InspectableWebContentsImpl::WebContentsFocused( + content::WebContents* contents) { + if (delegate_) + delegate_->DevToolsFocused(); +} + void InspectableWebContentsImpl::RequestFileSystems() { devtools_web_contents()->GetMainFrame()->ExecuteJavaScript( base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([])")); diff --git a/brightray/browser/inspectable_web_contents_impl.h b/brightray/browser/inspectable_web_contents_impl.h index 7e249e8aa6..a7e248d575 100644 --- a/brightray/browser/inspectable_web_contents_impl.h +++ b/brightray/browser/inspectable_web_contents_impl.h @@ -127,6 +127,7 @@ class InspectableWebContentsImpl : void HandleKeyboardEvent( content::WebContents*, const content::NativeWebKeyboardEvent&) override; void CloseContents(content::WebContents* source) override; + void WebContentsFocused(content::WebContents* contents) override; scoped_ptr web_contents_; scoped_ptr devtools_web_contents_;