| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <set> |
| 10 |
| 11 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
| 12 #include "content/browser/devtools/service_worker_devtools_manager.h" |
| 13 #include "content/public/browser/devtools_agent_host_client.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 class RenderFrameHostImpl; |
| 18 |
| 19 namespace devtools { |
| 20 namespace target { |
| 21 |
| 22 class TargetHandler : public DevToolsAgentHostClient, |
| 23 public ServiceWorkerDevToolsManager::Observer { |
| 24 public: |
| 25 using Response = DevToolsProtocolClient::Response; |
| 26 |
| 27 TargetHandler(); |
| 28 ~TargetHandler() override; |
| 29 |
| 30 void SetRenderFrameHost(RenderFrameHostImpl* render_frame_host); |
| 31 void SetClient(std::unique_ptr<Client> client); |
| 32 void Detached(); |
| 33 |
| 34 void UpdateServiceWorkers(); |
| 35 |
| 36 // Domain implementation. |
| 37 Response Enable(); |
| 38 Response Disable(); |
| 39 Response SetWaitForDebuggerOnStart(bool value); |
| 40 Response SendMessageToTarget(const std::string& target_id, |
| 41 const std::string& message); |
| 42 Response GetTargetInfo(const std::string& target_id, |
| 43 scoped_refptr<TargetInfo>* target_info); |
| 44 Response ActivateTarget(const std::string& target_id); |
| 45 |
| 46 private: |
| 47 void AttachToTargetInternal(DevToolsAgentHost* host, |
| 48 bool waiting_for_debugger); |
| 49 void DetachFromTargetInternal(DevToolsAgentHost* host); |
| 50 |
| 51 // ServiceWorkerDevToolsManager::Observer implementation. |
| 52 void WorkerCreated(ServiceWorkerDevToolsAgentHost* host) override; |
| 53 void WorkerReadyForInspection(ServiceWorkerDevToolsAgentHost* host) override; |
| 54 void WorkerVersionInstalled(ServiceWorkerDevToolsAgentHost* host) override; |
| 55 void WorkerVersionDoomed(ServiceWorkerDevToolsAgentHost* host) override; |
| 56 void WorkerDestroyed(ServiceWorkerDevToolsAgentHost* host) override; |
| 57 |
| 58 // DevToolsAgentHostClient implementation. |
| 59 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, |
| 60 const std::string& message) override; |
| 61 void AgentHostClosed(DevToolsAgentHost* agent_host, |
| 62 bool replaced_with_another_client) override; |
| 63 |
| 64 std::unique_ptr<Client> client_; |
| 65 bool enabled_; |
| 66 RenderFrameHostImpl* render_frame_host_; |
| 67 std::map<std::string, scoped_refptr<DevToolsAgentHost>> attached_hosts_; |
| 68 std::set<GURL> frame_urls_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(TargetHandler); |
| 71 }; |
| 72 |
| 73 } // namespace target |
| 74 } // namespace devtools |
| 75 } // namespace content |
| 76 |
| 77 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TARGET_HANDLER_H_ |
| OLD | NEW |