summaryrefslogtreecommitdiffstats
path: root/content/shell
diff options
context:
space:
mode:
Diffstat (limited to 'content/shell')
-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_; }