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

Side by Side Diff: content/renderer/devtools/devtools_agent.cc

Issue 1440383002: [DevTools] Move InspectElement call after OpenDevToolsWindow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « content/renderer/devtools/devtools_agent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/devtools/devtools_agent.h" 5 #include "content/renderer/devtools/devtools_agent.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 } 210 }
211 211
212 void DevToolsAgent::OnDispatchOnInspectorBackend(const std::string& message) { 212 void DevToolsAgent::OnDispatchOnInspectorBackend(const std::string& message) {
213 TRACE_EVENT0("devtools", "DevToolsAgent::OnDispatchOnInspectorBackend"); 213 TRACE_EVENT0("devtools", "DevToolsAgent::OnDispatchOnInspectorBackend");
214 WebDevToolsAgent* web_agent = GetWebAgent(); 214 WebDevToolsAgent* web_agent = GetWebAgent();
215 if (web_agent) 215 if (web_agent)
216 web_agent->dispatchOnInspectorBackend(WebString::fromUTF8(message)); 216 web_agent->dispatchOnInspectorBackend(WebString::fromUTF8(message));
217 } 217 }
218 218
219 void DevToolsAgent::OnInspectElement( 219 void DevToolsAgent::OnInspectElement(int x, int y) {
220 const std::string& host_id, int x, int y) {
221 WebDevToolsAgent* web_agent = GetWebAgent(); 220 WebDevToolsAgent* web_agent = GetWebAgent();
222 if (web_agent) { 221 if (web_agent) {
223 web_agent->attach(WebString::fromUTF8(host_id)); 222 DCHECK(is_attached_);
224 web_agent->inspectElementAt(WebPoint(x, y)); 223 web_agent->inspectElementAt(WebPoint(x, y));
225 is_attached_ = true;
226 } 224 }
227 } 225 }
228 226
229 void DevToolsAgent::AddMessageToConsole(ConsoleMessageLevel level, 227 void DevToolsAgent::AddMessageToConsole(ConsoleMessageLevel level,
230 const std::string& message) { 228 const std::string& message) {
231 WebLocalFrame* web_frame = frame_->GetWebFrame(); 229 WebLocalFrame* web_frame = frame_->GetWebFrame();
232 if (!web_frame) 230 if (!web_frame)
233 return; 231 return;
234 232
235 WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog; 233 WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { 268 WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
271 WebLocalFrame* web_frame = frame_->GetWebFrame(); 269 WebLocalFrame* web_frame = frame_->GetWebFrame();
272 return web_frame ? web_frame->devToolsAgent() : nullptr; 270 return web_frame ? web_frame->devToolsAgent() : nullptr;
273 } 271 }
274 272
275 bool DevToolsAgent::IsAttached() { 273 bool DevToolsAgent::IsAttached() {
276 return is_attached_; 274 return is_attached_;
277 } 275 }
278 276
279 } // namespace content 277 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/devtools/devtools_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698