OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell/browser/shell_devtools_frontend.h" | 5 #include "content/shell/browser/shell_devtools_frontend.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 agent_host_->InspectElement(x, y); | 136 agent_host_->InspectElement(x, y); |
137 } | 137 } |
138 | 138 |
139 void ShellDevToolsFrontend::Close() { | 139 void ShellDevToolsFrontend::Close() { |
140 frontend_shell_->Close(); | 140 frontend_shell_->Close(); |
141 } | 141 } |
142 | 142 |
143 void ShellDevToolsFrontend::DisconnectFromTarget() { | 143 void ShellDevToolsFrontend::DisconnectFromTarget() { |
144 if (!agent_host_) | 144 if (!agent_host_) |
145 return; | 145 return; |
146 agent_host_->DetachClient(); | 146 agent_host_->DetachClient(this); |
147 agent_host_ = NULL; | 147 agent_host_ = NULL; |
148 } | 148 } |
149 | 149 |
150 ShellDevToolsFrontend::ShellDevToolsFrontend(Shell* frontend_shell, | 150 ShellDevToolsFrontend::ShellDevToolsFrontend(Shell* frontend_shell, |
151 WebContents* inspected_contents) | 151 WebContents* inspected_contents) |
152 : WebContentsObserver(frontend_shell->web_contents()), | 152 : WebContentsObserver(frontend_shell->web_contents()), |
153 frontend_shell_(frontend_shell), | 153 frontend_shell_(frontend_shell), |
154 inspected_contents_(inspected_contents), | 154 inspected_contents_(inspected_contents), |
155 weak_factory_(this) { | 155 weak_factory_(this) { |
156 } | 156 } |
(...skipping 13 matching lines...) Expand all Loading... |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void ShellDevToolsFrontend::DocumentAvailableInMainFrame() { | 173 void ShellDevToolsFrontend::DocumentAvailableInMainFrame() { |
174 agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_); | 174 agent_host_ = DevToolsAgentHost::GetOrCreateFor(inspected_contents_); |
175 agent_host_->AttachClient(this); | 175 agent_host_->AttachClient(this); |
176 } | 176 } |
177 | 177 |
178 void ShellDevToolsFrontend::WebContentsDestroyed() { | 178 void ShellDevToolsFrontend::WebContentsDestroyed() { |
179 if (agent_host_) | 179 if (agent_host_) |
180 agent_host_->DetachClient(); | 180 agent_host_->DetachClient(this); |
181 delete this; | 181 delete this; |
182 } | 182 } |
183 | 183 |
184 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( | 184 void ShellDevToolsFrontend::HandleMessageFromDevToolsFrontend( |
185 const std::string& message) { | 185 const std::string& message) { |
186 if (!agent_host_) | 186 if (!agent_host_) |
187 return; | 187 return; |
188 std::string method; | 188 std::string method; |
189 base::ListValue* params = NULL; | 189 base::ListValue* params = NULL; |
190 base::DictionaryValue* dict = NULL; | 190 base::DictionaryValue* dict = NULL; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 CallClientFunction("DevToolsAPI.embedderMessageAck", | 345 CallClientFunction("DevToolsAPI.embedderMessageAck", |
346 &id_value, arg, nullptr); | 346 &id_value, arg, nullptr); |
347 } | 347 } |
348 | 348 |
349 void ShellDevToolsFrontend::AgentHostClosed( | 349 void ShellDevToolsFrontend::AgentHostClosed( |
350 DevToolsAgentHost* agent_host, bool replaced) { | 350 DevToolsAgentHost* agent_host, bool replaced) { |
351 frontend_shell_->Close(); | 351 frontend_shell_->Close(); |
352 } | 352 } |
353 | 353 |
354 } // namespace content | 354 } // namespace content |
OLD | NEW |