Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1727)

Unified Diff: content/shell/browser/shell_devtools_frontend.cc

Issue 2161493002: [DevTools] Pass client initiating DevToolsAgentHost::inspectElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/shell_devtools_frontend.cc
diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc
index 982337a0155b50e36249f6ac5f9bd3e7c6a8be63..d4ffd09b7f7866ed29409315485d797dde6cbb10 100644
--- a/content/shell/browser/shell_devtools_frontend.cc
+++ b/content/shell/browser/shell_devtools_frontend.cc
@@ -132,8 +132,12 @@ void ShellDevToolsFrontend::Focus() {
}
void ShellDevToolsFrontend::InspectElementAt(int x, int y) {
- if (agent_host_)
- agent_host_->InspectElement(x, y);
+ if (agent_host_) {
+ agent_host_->InspectElement(this, x, y);
+ } else {
+ inspect_element_at_x_ = x;
+ inspect_element_at_y_ = y;
+ }
}
void ShellDevToolsFrontend::Close() {
@@ -152,6 +156,8 @@ ShellDevToolsFrontend::ShellDevToolsFrontend(Shell* frontend_shell,
: WebContentsObserver(frontend_shell->web_contents()),
frontend_shell_(frontend_shell),
inspected_contents_(inspected_contents),
+ inspect_element_at_x_(-1),
+ inspect_element_at_y_(-1),
weak_factory_(this) {
}
@@ -173,6 +179,12 @@ void ShellDevToolsFrontend::RenderViewCreated(
void ShellDevToolsFrontend::DocumentAvailableInMainFrame() {
agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_);
agent_host_->AttachClient(this);
+ if (inspect_element_at_x_ != -1) {
+ agent_host_->InspectElement(
+ this, inspect_element_at_x_, inspect_element_at_y_);
+ inspect_element_at_x_ = -1;
+ inspect_element_at_y_ = -1;
+ }
}
void ShellDevToolsFrontend::WebContentsDestroyed() {
« no previous file with comments | « content/shell/browser/shell_devtools_frontend.h ('k') | third_party/WebKit/Source/web/WebDevToolsAgentImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698