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/devtools_manager.h" | 7 #include "content/browser/devtools/devtools_manager.h" |
| 8 #include "content/browser/devtools/devtools_session.h" |
8 #include "content/browser/devtools/service_worker_devtools_agent_host.h" | 9 #include "content/browser/devtools/service_worker_devtools_agent_host.h" |
9 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
10 #include "content/browser/frame_host/frame_tree_node.h" | 11 #include "content/browser/frame_host/frame_tree_node.h" |
11 #include "content/browser/frame_host/render_frame_host_impl.h" | 12 #include "content/browser/frame_host/render_frame_host_impl.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 namespace protocol { | 15 namespace protocol { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 .SetTargetId(host->GetId()) | 87 .SetTargetId(host->GetId()) |
87 .SetTitle(host->GetTitle()) | 88 .SetTitle(host->GetTitle()) |
88 .SetUrl(host->GetURL().spec()) | 89 .SetUrl(host->GetURL().spec()) |
89 .SetType(host->GetType()) | 90 .SetType(host->GetType()) |
90 .Build(); | 91 .Build(); |
91 } | 92 } |
92 | 93 |
93 } // namespace | 94 } // namespace |
94 | 95 |
95 TargetHandler::TargetHandler() | 96 TargetHandler::TargetHandler() |
96 : discover_(false), | 97 : DevToolsDomainHandler(Target::Metainfo::domainName), |
| 98 discover_(false), |
97 auto_attach_(false), | 99 auto_attach_(false), |
98 wait_for_debugger_on_start_(false), | 100 wait_for_debugger_on_start_(false), |
99 attach_to_frames_(false), | 101 attach_to_frames_(false), |
100 render_frame_host_(nullptr) { | 102 render_frame_host_(nullptr) { |
101 } | 103 } |
102 | 104 |
103 TargetHandler::~TargetHandler() { | 105 TargetHandler::~TargetHandler() { |
104 } | 106 } |
105 | 107 |
| 108 // static |
| 109 TargetHandler* TargetHandler::FromSession(DevToolsSession* session) { |
| 110 return static_cast<TargetHandler*>( |
| 111 session->GetHandlerByName(Target::Metainfo::domainName)); |
| 112 } |
| 113 |
106 void TargetHandler::Wire(UberDispatcher* dispatcher) { | 114 void TargetHandler::Wire(UberDispatcher* dispatcher) { |
107 frontend_.reset(new Target::Frontend(dispatcher->channel())); | 115 frontend_.reset(new Target::Frontend(dispatcher->channel())); |
108 Target::Dispatcher::wire(dispatcher, this); | 116 Target::Dispatcher::wire(dispatcher, this); |
109 } | 117 } |
110 | 118 |
111 void TargetHandler::SetRenderFrameHost(RenderFrameHostImpl* render_frame_host) { | 119 void TargetHandler::SetRenderFrameHost(RenderFrameHostImpl* render_frame_host) { |
112 render_frame_host_ = render_frame_host; | 120 render_frame_host_ = render_frame_host; |
113 UpdateFrames(); | 121 UpdateFrames(); |
114 } | 122 } |
115 | 123 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 UpdateServiceWorkers(); | 456 UpdateServiceWorkers(); |
449 } | 457 } |
450 | 458 |
451 void TargetHandler::WorkerDestroyed( | 459 void TargetHandler::WorkerDestroyed( |
452 ServiceWorkerDevToolsAgentHost* host) { | 460 ServiceWorkerDevToolsAgentHost* host) { |
453 UpdateServiceWorkers(); | 461 UpdateServiceWorkers(); |
454 } | 462 } |
455 | 463 |
456 } // namespace protocol | 464 } // namespace protocol |
457 } // namespace content | 465 } // namespace content |
OLD | NEW |