OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/protocol/target_handler.h" | 5 #include "content/browser/devtools/protocol/target_handler.h" |
6 | 6 |
7 #include "content/browser/devtools/service_worker_devtools_agent_host.h" | 7 #include "content/browser/devtools/service_worker_devtools_agent_host.h" |
8 #include "content/browser/frame_host/frame_tree.h" | 8 #include "content/browser/frame_host/frame_tree.h" |
9 #include "content/browser/frame_host/frame_tree_node.h" | 9 #include "content/browser/frame_host/frame_tree_node.h" |
10 #include "content/browser/frame_host/render_frame_host_impl.h" | 10 #include "content/browser/frame_host/render_frame_host_impl.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 UpdateFrames(); | 102 UpdateFrames(); |
103 } | 103 } |
104 | 104 |
105 void TargetHandler::SetClient(std::unique_ptr<Client> client) { | 105 void TargetHandler::SetClient(std::unique_ptr<Client> client) { |
106 client_.swap(client); | 106 client_.swap(client); |
107 } | 107 } |
108 | 108 |
109 void TargetHandler::Detached() { | 109 void TargetHandler::Detached() { |
110 SetAutoAttach(false, false); | 110 SetAutoAttach(false, false); |
111 SetDiscoverTargets(false); | 111 SetDiscoverTargets(false); |
| 112 for (const auto& id_host : attached_hosts_) |
| 113 id_host.second->DetachClient(this); |
| 114 attached_hosts_.clear(); |
112 } | 115 } |
113 | 116 |
114 void TargetHandler::UpdateServiceWorkers() { | 117 void TargetHandler::UpdateServiceWorkers() { |
115 UpdateServiceWorkers(false); | 118 UpdateServiceWorkers(false); |
116 } | 119 } |
117 | 120 |
118 void TargetHandler::UpdateFrames() { | 121 void TargetHandler::UpdateFrames() { |
119 if (!auto_attach_ || !attach_to_frames_) | 122 if (!auto_attach_ || !attach_to_frames_) |
120 return; | 123 return; |
121 | 124 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 attach_to_frames_ = value; | 275 attach_to_frames_ = value; |
273 if (attach_to_frames_) { | 276 if (attach_to_frames_) { |
274 UpdateFrames(); | 277 UpdateFrames(); |
275 } else { | 278 } else { |
276 HostsMap empty; | 279 HostsMap empty; |
277 ReattachTargetsOfType(empty, DevToolsAgentHost::kTypeFrame, false); | 280 ReattachTargetsOfType(empty, DevToolsAgentHost::kTypeFrame, false); |
278 } | 281 } |
279 return Response::OK(); | 282 return Response::OK(); |
280 } | 283 } |
281 | 284 |
| 285 Response TargetHandler::SetRemoteLocations( |
| 286 const std::vector<std::unique_ptr<base::DictionaryValue>>& locations) { |
| 287 return Response::ServerError("Not supported"); |
| 288 } |
| 289 |
282 Response TargetHandler::AttachToTarget(const std::string& target_id, | 290 Response TargetHandler::AttachToTarget(const std::string& target_id, |
283 bool* out_success) { | 291 bool* out_success) { |
284 auto it = reported_hosts_.find(target_id); | 292 auto it = reported_hosts_.find(target_id); |
285 if (it == reported_hosts_.end()) | 293 if (it == reported_hosts_.end()) |
286 return Response::InvalidParams("No target with such id"); | 294 return Response::InvalidParams("No target with such id"); |
287 *out_success = AttachToTargetInternal(it->second, false); | 295 *out_success = AttachToTargetInternal(it->second, false); |
288 return Response::OK(); | 296 return Response::OK(); |
289 } | 297 } |
290 | 298 |
291 Response TargetHandler::DetachFromTarget(const std::string& target_id) { | 299 Response TargetHandler::DetachFromTarget(const std::string& target_id) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 416 } |
409 | 417 |
410 void TargetHandler::WorkerDestroyed( | 418 void TargetHandler::WorkerDestroyed( |
411 ServiceWorkerDevToolsAgentHost* host) { | 419 ServiceWorkerDevToolsAgentHost* host) { |
412 UpdateServiceWorkers(); | 420 UpdateServiceWorkers(); |
413 } | 421 } |
414 | 422 |
415 } // namespace target | 423 } // namespace target |
416 } // namespace devtools | 424 } // namespace devtools |
417 } // namespace content | 425 } // namespace content |
OLD | NEW |