| 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 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 using Response = DevToolsProtocolClient::Response; | 25 using Response = DevToolsProtocolClient::Response; |
| 26 | 26 |
| 27 TargetHandler(); | 27 TargetHandler(); |
| 28 ~TargetHandler() override; | 28 ~TargetHandler() override; |
| 29 | 29 |
| 30 void SetRenderFrameHost(RenderFrameHostImpl* render_frame_host); | 30 void SetRenderFrameHost(RenderFrameHostImpl* render_frame_host); |
| 31 void SetClient(std::unique_ptr<Client> client); | 31 void SetClient(std::unique_ptr<Client> client); |
| 32 void Detached(); | 32 void Detached(); |
| 33 | 33 |
| 34 void UpdateServiceWorkers(); | 34 void UpdateServiceWorkers(); |
| 35 void UpdateFrames(); |
| 35 | 36 |
| 36 // Domain implementation. | 37 // Domain implementation. |
| 37 Response Enable(); | 38 Response Enable(); |
| 38 Response Disable(); | 39 Response Disable(); |
| 39 Response SetWaitForDebuggerOnStart(bool value); | 40 Response SetWaitForDebuggerOnStart(bool value); |
| 41 Response SetAttachToFrames(bool value); |
| 40 Response SendMessageToTarget(const std::string& target_id, | 42 Response SendMessageToTarget(const std::string& target_id, |
| 41 const std::string& message); | 43 const std::string& message); |
| 42 Response GetTargetInfo(const std::string& target_id, | 44 Response GetTargetInfo(const std::string& target_id, |
| 43 scoped_refptr<TargetInfo>* target_info); | 45 scoped_refptr<TargetInfo>* target_info); |
| 44 Response ActivateTarget(const std::string& target_id); | 46 Response ActivateTarget(const std::string& target_id); |
| 45 | 47 |
| 46 private: | 48 private: |
| 49 using HostsMap = std::map<std::string, scoped_refptr<DevToolsAgentHost>>; |
| 50 |
| 47 void UpdateServiceWorkers(bool waiting_for_debugger); | 51 void UpdateServiceWorkers(bool waiting_for_debugger); |
| 52 void ReattachTargetsOfType(const HostsMap& new_hosts, |
| 53 const std::string& type, |
| 54 bool waiting_for_debugger); |
| 48 void AttachToTargetInternal(DevToolsAgentHost* host, | 55 void AttachToTargetInternal(DevToolsAgentHost* host, |
| 49 bool waiting_for_debugger); | 56 bool waiting_for_debugger); |
| 50 void DetachFromTargetInternal(DevToolsAgentHost* host); | 57 void DetachFromTargetInternal(DevToolsAgentHost* host); |
| 51 | 58 |
| 52 // ServiceWorkerDevToolsManager::Observer implementation. | 59 // ServiceWorkerDevToolsManager::Observer implementation. |
| 53 void WorkerCreated(ServiceWorkerDevToolsAgentHost* host) override; | 60 void WorkerCreated(ServiceWorkerDevToolsAgentHost* host) override; |
| 54 void WorkerReadyForInspection(ServiceWorkerDevToolsAgentHost* host) override; | 61 void WorkerReadyForInspection(ServiceWorkerDevToolsAgentHost* host) override; |
| 55 void WorkerVersionInstalled(ServiceWorkerDevToolsAgentHost* host) override; | 62 void WorkerVersionInstalled(ServiceWorkerDevToolsAgentHost* host) override; |
| 56 void WorkerVersionDoomed(ServiceWorkerDevToolsAgentHost* host) override; | 63 void WorkerVersionDoomed(ServiceWorkerDevToolsAgentHost* host) override; |
| 57 void WorkerDestroyed(ServiceWorkerDevToolsAgentHost* host) override; | 64 void WorkerDestroyed(ServiceWorkerDevToolsAgentHost* host) override; |
| 58 | 65 |
| 59 // DevToolsAgentHostClient implementation. | 66 // DevToolsAgentHostClient implementation. |
| 60 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, | 67 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, |
| 61 const std::string& message) override; | 68 const std::string& message) override; |
| 62 void AgentHostClosed(DevToolsAgentHost* agent_host, | 69 void AgentHostClosed(DevToolsAgentHost* agent_host, |
| 63 bool replaced_with_another_client) override; | 70 bool replaced_with_another_client) override; |
| 64 | 71 |
| 65 std::unique_ptr<Client> client_; | 72 std::unique_ptr<Client> client_; |
| 66 bool enabled_; | 73 bool enabled_; |
| 67 bool wait_for_debugger_on_start_; | 74 bool wait_for_debugger_on_start_; |
| 75 bool attach_to_frames_; |
| 68 RenderFrameHostImpl* render_frame_host_; | 76 RenderFrameHostImpl* render_frame_host_; |
| 69 std::map<std::string, scoped_refptr<DevToolsAgentHost>> attached_hosts_; | 77 HostsMap attached_hosts_; |
| 70 std::set<GURL> frame_urls_; | 78 std::set<GURL> frame_urls_; |
| 71 | 79 |
| 72 DISALLOW_COPY_AND_ASSIGN(TargetHandler); | 80 DISALLOW_COPY_AND_ASSIGN(TargetHandler); |
| 73 }; | 81 }; |
| 74 | 82 |
| 75 } // namespace target | 83 } // namespace target |
| 76 } // namespace devtools | 84 } // namespace devtools |
| 77 } // namespace content | 85 } // namespace content |
| 78 | 86 |
| 79 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ | 87 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ |
| OLD | NEW |