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

Side by Side Diff: content/browser/devtools/render_frame_devtools_agent_host.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 unified diff | Download patch
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/browser/devtools/render_frame_devtools_agent_host.h" 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 RenderFrameHostImpl* host() const { return host_; } 98 RenderFrameHostImpl* host() const { return host_; }
99 99
100 void Attach(); 100 void Attach();
101 void Reattach(FrameHostHolder* old); 101 void Reattach(FrameHostHolder* old);
102 void Detach(); 102 void Detach();
103 void DispatchProtocolMessage(int session_id, 103 void DispatchProtocolMessage(int session_id,
104 int call_id, 104 int call_id,
105 const std::string& method, 105 const std::string& method,
106 const std::string& message); 106 const std::string& message);
107 void InspectElement(int x, int y); 107 void InspectElement(int session_id, int x, int y);
108 void ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); 108 void ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk);
109 void Suspend(); 109 void Suspend();
110 void Resume(); 110 void Resume();
111 111
112 private: 112 private:
113 void GrantPolicy(); 113 void GrantPolicy();
114 void RevokePolicy(); 114 void RevokePolicy();
115 void SendMessageToClient(int session_id, const std::string& message); 115 void SendMessageToClient(int session_id, const std::string& message);
116 116
117 RenderFrameDevToolsAgentHost* agent_; 117 RenderFrameDevToolsAgentHost* agent_;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 int session_id, 204 int session_id,
205 int call_id, 205 int call_id,
206 const std::string& method, 206 const std::string& method,
207 const std::string& message) { 207 const std::string& message) {
208 host_->Send(new DevToolsAgentMsg_DispatchOnInspectorBackend( 208 host_->Send(new DevToolsAgentMsg_DispatchOnInspectorBackend(
209 host_->GetRoutingID(), session_id, call_id, method, message)); 209 host_->GetRoutingID(), session_id, call_id, method, message));
210 sent_messages_[call_id] = { session_id, method, message }; 210 sent_messages_[call_id] = { session_id, method, message };
211 } 211 }
212 212
213 void RenderFrameDevToolsAgentHost::FrameHostHolder::InspectElement( 213 void RenderFrameDevToolsAgentHost::FrameHostHolder::InspectElement(
214 int x, int y) { 214 int session_id, int x, int y) {
215 DCHECK(attached_); 215 DCHECK(attached_);
216 host_->Send(new DevToolsAgentMsg_InspectElement( 216 host_->Send(new DevToolsAgentMsg_InspectElement(
217 host_->GetRoutingID(), x, y)); 217 host_->GetRoutingID(), session_id, x, y));
218 } 218 }
219 219
220 void 220 void
221 RenderFrameDevToolsAgentHost::FrameHostHolder::ProcessChunkedMessageFromAgent( 221 RenderFrameDevToolsAgentHost::FrameHostHolder::ProcessChunkedMessageFromAgent(
222 const DevToolsMessageChunk& chunk) { 222 const DevToolsMessageChunk& chunk) {
223 chunk_processor_.ProcessChunkedMessageFromAgent(chunk); 223 chunk_processor_.ProcessChunkedMessageFromAgent(chunk);
224 } 224 }
225 225
226 void RenderFrameDevToolsAgentHost::FrameHostHolder::SendMessageToClient( 226 void RenderFrameDevToolsAgentHost::FrameHostHolder::SendMessageToClient(
227 int session_id, 227 int session_id,
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 503
504 if (current_) 504 if (current_)
505 current_->DispatchProtocolMessage(session_id(), call_id, method, message); 505 current_->DispatchProtocolMessage(session_id(), call_id, method, message);
506 if (pending_) 506 if (pending_)
507 pending_->DispatchProtocolMessage(session_id(), call_id, method, message); 507 pending_->DispatchProtocolMessage(session_id(), call_id, method, message);
508 return true; 508 return true;
509 } 509 }
510 510
511 void RenderFrameDevToolsAgentHost::InspectElement(int x, int y) { 511 void RenderFrameDevToolsAgentHost::InspectElement(int x, int y) {
512 if (current_) 512 if (current_)
513 current_->InspectElement(x, y); 513 current_->InspectElement(session_id(), x, y);
514 if (pending_) 514 if (pending_)
515 pending_->InspectElement(x, y); 515 pending_->InspectElement(session_id(), x, y);
516 } 516 }
517 517
518 void RenderFrameDevToolsAgentHost::OnClientAttached() { 518 void RenderFrameDevToolsAgentHost::OnClientAttached() {
519 if (!web_contents()) 519 if (!web_contents())
520 return; 520 return;
521 521
522 frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder()); 522 frame_trace_recorder_.reset(new DevToolsFrameTraceRecorder());
523 #if defined(OS_ANDROID) 523 #if defined(OS_ANDROID)
524 power_save_blocker_.reset(new device::PowerSaveBlocker( 524 power_save_blocker_.reset(new device::PowerSaveBlocker(
525 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, 525 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 RenderFrameHost* host) { 943 RenderFrameHost* host) {
944 return (current_ && current_->host() == host) || 944 return (current_ && current_->host() == host) ||
945 (pending_ && pending_->host() == host); 945 (pending_ && pending_->host() == host);
946 } 946 }
947 947
948 bool RenderFrameDevToolsAgentHost::IsChildFrame() { 948 bool RenderFrameDevToolsAgentHost::IsChildFrame() {
949 return current_ && current_->host()->GetParent(); 949 return current_ && current_->host()->GetParent();
950 } 950 }
951 951
952 } // namespace content 952 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools_agent_host_impl.cc ('k') | content/common/devtools_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698