Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: content/browser/devtools/protocol/service_worker_handler.h

Issue 2354973003: [DevTools] Move subtargets functionality from ServiceWorker to Target domain. (Closed)
Patch Set: review comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_SERVICE_WORKER_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_ 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 15 matching lines...) Expand all
26 26
27 namespace content { 27 namespace content {
28 28
29 class RenderFrameHostImpl; 29 class RenderFrameHostImpl;
30 class ServiceWorkerContextWatcher; 30 class ServiceWorkerContextWatcher;
31 class ServiceWorkerContextWrapper; 31 class ServiceWorkerContextWrapper;
32 32
33 namespace devtools { 33 namespace devtools {
34 namespace service_worker { 34 namespace service_worker {
35 35
36 class ServiceWorkerHandler : public DevToolsAgentHostClient, 36 class ServiceWorkerHandler {
37 public ServiceWorkerDevToolsManager::Observer {
38 public: 37 public:
39 typedef DevToolsProtocolClient::Response Response; 38 typedef DevToolsProtocolClient::Response Response;
40 39
41 ServiceWorkerHandler(); 40 ServiceWorkerHandler();
42 ~ServiceWorkerHandler() override; 41 ~ServiceWorkerHandler();
43 42
44 void SetRenderFrameHost(RenderFrameHostImpl* render_frame_host); 43 void SetRenderFrameHost(RenderFrameHostImpl* render_frame_host);
45 void SetClient(std::unique_ptr<Client> client); 44 void SetClient(std::unique_ptr<Client> client);
46 void UpdateHosts();
47 void Detached(); 45 void Detached();
48 46
49 // Protocol 'service worker' domain implementation. 47 // Protocol 'service worker' domain implementation.
50 Response Enable(); 48 Response Enable();
51 Response Disable(); 49 Response Disable();
52 Response SendMessage(const std::string& worker_id,
53 const std::string& message);
54 Response Stop(const std::string& worker_id);
55 Response Unregister(const std::string& scope_url); 50 Response Unregister(const std::string& scope_url);
56 Response StartWorker(const std::string& scope_url); 51 Response StartWorker(const std::string& scope_url);
57 Response SkipWaiting(const std::string& scope_url); 52 Response SkipWaiting(const std::string& scope_url);
58 Response StopWorker(const std::string& version_id); 53 Response StopWorker(const std::string& version_id);
59 Response UpdateRegistration(const std::string& scope_url); 54 Response UpdateRegistration(const std::string& scope_url);
60 Response InspectWorker(const std::string& version_id); 55 Response InspectWorker(const std::string& version_id);
61 Response SetForceUpdateOnPageLoad(bool force_update_on_page_load); 56 Response SetForceUpdateOnPageLoad(bool force_update_on_page_load);
62 Response DeliverPushMessage(const std::string& origin, 57 Response DeliverPushMessage(const std::string& origin,
63 const std::string& registration_id, 58 const std::string& registration_id,
64 const std::string& data); 59 const std::string& data);
65 Response DispatchSyncEvent(const std::string& origin, 60 Response DispatchSyncEvent(const std::string& origin,
66 const std::string& registration_id, 61 const std::string& registration_id,
67 const std::string& tag, 62 const std::string& tag,
68 bool last_chance); 63 bool last_chance);
69 Response GetTargetInfo(const std::string& target_id,
70 scoped_refptr<TargetInfo>* target_info);
71 Response ActivateTarget(const std::string& target_id);
72
73 // WorkerDevToolsManager::Observer implementation.
74 void WorkerCreated(ServiceWorkerDevToolsAgentHost* host) override;
75 void WorkerReadyForInspection(ServiceWorkerDevToolsAgentHost* host) override;
76 void WorkerVersionInstalled(ServiceWorkerDevToolsAgentHost* host) override;
77 void WorkerVersionDoomed(ServiceWorkerDevToolsAgentHost* host) override;
78 void WorkerDestroyed(ServiceWorkerDevToolsAgentHost* host) override;
79 64
80 private: 65 private:
81 // DevToolsAgentHostClient overrides.
82 void DispatchProtocolMessage(DevToolsAgentHost* agent_host,
83 const std::string& message) override;
84 void AgentHostClosed(DevToolsAgentHost* agent_host,
85 bool replaced_with_another_client) override;
86
87 void ReportWorkerCreated(ServiceWorkerDevToolsAgentHost* host);
88 void ReportWorkerTerminated(ServiceWorkerDevToolsAgentHost* host);
89
90 void OnWorkerRegistrationUpdated( 66 void OnWorkerRegistrationUpdated(
91 const std::vector<ServiceWorkerRegistrationInfo>& registrations); 67 const std::vector<ServiceWorkerRegistrationInfo>& registrations);
92 void OnWorkerVersionUpdated( 68 void OnWorkerVersionUpdated(
93 const std::vector<ServiceWorkerVersionInfo>& registrations); 69 const std::vector<ServiceWorkerVersionInfo>& registrations);
94 void OnErrorReported(int64_t registration_id, 70 void OnErrorReported(int64_t registration_id,
95 int64_t version_id, 71 int64_t version_id,
96 const ServiceWorkerContextObserver::ErrorInfo& info); 72 const ServiceWorkerContextObserver::ErrorInfo& info);
97 73
98 void OpenNewDevToolsWindow(int process_id, int devtools_agent_route_id); 74 void OpenNewDevToolsWindow(int process_id, int devtools_agent_route_id);
99 void ClearForceUpdate(); 75 void ClearForceUpdate();
100 76
101 scoped_refptr<ServiceWorkerContextWrapper> context_; 77 scoped_refptr<ServiceWorkerContextWrapper> context_;
102 std::unique_ptr<Client> client_; 78 std::unique_ptr<Client> client_;
103 ServiceWorkerDevToolsAgentHost::Map attached_hosts_;
104 bool enabled_; 79 bool enabled_;
105 std::set<GURL> urls_;
106 scoped_refptr<ServiceWorkerContextWatcher> context_watcher_; 80 scoped_refptr<ServiceWorkerContextWatcher> context_watcher_;
107 RenderFrameHostImpl* render_frame_host_; 81 RenderFrameHostImpl* render_frame_host_;
108 82
109 base::WeakPtrFactory<ServiceWorkerHandler> weak_factory_; 83 base::WeakPtrFactory<ServiceWorkerHandler> weak_factory_;
110 84
111 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandler); 85 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandler);
112 }; 86 };
113 87
114 } // namespace service_worker 88 } // namespace service_worker
115 } // namespace devtools 89 } // namespace devtools
116 } // namespace content 90 } // namespace content
117 91
118 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_ 92 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/schema_handler.cc ('k') | content/browser/devtools/protocol/service_worker_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698