summaryrefslogtreecommitdiffstats
path: root/content/shell/browser
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-10 14:36:48 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-10 14:36:48 +0000
commit2317fcd15f9b518dd047cce6e2f00e20dfa51dee (patch)
treef5d6c2c45a803c3eafcf7adfb27b6681a0dc7c2a /content/shell/browser
parent48cc692732281b7a93d297e14a136a0c232ec209 (diff)
downloadchromium_src-2317fcd15f9b518dd047cce6e2f00e20dfa51dee.zip
chromium_src-2317fcd15f9b518dd047cce6e2f00e20dfa51dee.tar.gz
chromium_src-2317fcd15f9b518dd047cce6e2f00e20dfa51dee.tar.bz2
Make Inspect Element work w/ DevTools opened in content shell.
Review URL: https://codereview.chromium.org/149293007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/browser')
-rw-r--r--content/shell/browser/shell.cc19
-rw-r--r--content/shell/browser/shell_devtools_frontend.cc15
-rw-r--r--content/shell/browser/shell_devtools_frontend.h3
3 files changed, 15 insertions, 22 deletions
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc
index d5f1661..fc60b66 100644
--- a/content/shell/browser/shell.cc
+++ b/content/shell/browser/shell.cc
@@ -215,18 +215,19 @@ void Shell::UpdateNavigationControls() {
}
void Shell::ShowDevTools() {
- ShowDevToolsForElementAt(-1, -1);
+ if (!devtools_frontend_) {
+ devtools_frontend_ = ShellDevToolsFrontend::Show(web_contents());
+ devtools_observer_.reset(new DevToolsWebContentsObserver(
+ this, devtools_frontend_->frontend_shell()->web_contents()));
+ }
+
+ devtools_frontend_->Activate();
+ devtools_frontend_->Focus();
}
void Shell::ShowDevToolsForElementAt(int x, int y) {
- if (devtools_frontend_) {
- devtools_frontend_->Focus();
- return;
- }
- devtools_frontend_ = ShellDevToolsFrontend::ShowForElementAt(
- web_contents(), x, y);
- devtools_observer_.reset(new DevToolsWebContentsObserver(
- this, devtools_frontend_->frontend_shell()->web_contents()));
+ ShowDevTools();
+ devtools_frontend_->InspectElementAt(x, y);
}
void Shell::CloseDevTools() {
diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc
index 7076ff0..b1f4e0c0 100644
--- a/content/shell/browser/shell_devtools_frontend.cc
+++ b/content/shell/browser/shell_devtools_frontend.cc
@@ -44,17 +44,9 @@ GURL GetDevToolsPathAsURL() {
// static
ShellDevToolsFrontend* ShellDevToolsFrontend::Show(
WebContents* inspected_contents) {
- return ShowForElementAt(inspected_contents, -1, -1);
-}
-
-// static
-ShellDevToolsFrontend* ShellDevToolsFrontend::ShowForElementAt(
- WebContents* inspected_contents, int x, int y) {
scoped_refptr<DevToolsAgentHost> agent(
DevToolsAgentHost::GetOrCreateFor(
inspected_contents->GetRenderViewHost()));
- if (x > -1 && y > -1)
- agent->InspectElement(x, y);
Shell* shell = Shell::CreateNewWindow(inspected_contents->GetBrowserContext(),
GURL(),
NULL,
@@ -71,9 +63,6 @@ ShellDevToolsFrontend* ShellDevToolsFrontend::ShowForElementAt(
else
shell->LoadURL(delegate->devtools_http_handler()->GetFrontendURL());
- devtools_frontend->Activate();
- devtools_frontend->Focus();
-
return devtools_frontend;
}
@@ -85,6 +74,10 @@ void ShellDevToolsFrontend::Focus() {
web_contents()->GetView()->Focus();
}
+void ShellDevToolsFrontend::InspectElementAt(int x, int y) {
+ agent_host_->InspectElement(x, y);
+}
+
void ShellDevToolsFrontend::Close() {
frontend_shell_->Close();
}
diff --git a/content/shell/browser/shell_devtools_frontend.h b/content/shell/browser/shell_devtools_frontend.h
index 7c85190..0797156 100644
--- a/content/shell/browser/shell_devtools_frontend.h
+++ b/content/shell/browser/shell_devtools_frontend.h
@@ -26,10 +26,9 @@ class ShellDevToolsFrontend : public WebContentsObserver,
public DevToolsFrontendHostDelegate {
public:
static ShellDevToolsFrontend* Show(WebContents* inspected_contents);
- static ShellDevToolsFrontend* ShowForElementAt(
- WebContents* inspected_contents, int x, int y);
void Activate();
void Focus();
+ void InspectElementAt(int x, int y);
void Close();
Shell* frontend_shell() const { return frontend_shell_; }