detecting focus on devtools webcontents

This commit is contained in:
Robo 2015-03-31 21:17:28 +05:30
parent 17f1fc618e
commit 4ae52721c4
3 changed files with 8 additions and 0 deletions

View file

@ -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.

View file

@ -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([])"));

View file

@ -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<content::WebContents> web_contents_;
scoped_ptr<content::WebContents> devtools_web_contents_;