OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/devtools/devtools_targets_ui.h" | 5 #include "chrome/browser/devtools/devtools_targets_ui.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 private: | 120 private: |
121 friend class base::RefCountedThreadSafe<WorkerObserver>; | 121 friend class base::RefCountedThreadSafe<WorkerObserver>; |
122 virtual ~WorkerObserver() {} | 122 virtual ~WorkerObserver() {} |
123 | 123 |
124 // content::WorkerServiceObserver overrides: | 124 // content::WorkerServiceObserver overrides: |
125 virtual void WorkerCreated( | 125 virtual void WorkerCreated( |
126 const GURL& url, | 126 const GURL& url, |
127 const base::string16& name, | 127 const base::string16& name, |
128 int process_id, | 128 int process_id, |
129 int route_id) OVERRIDE { | 129 int route_id) override { |
130 NotifyOnIOThread(); | 130 NotifyOnIOThread(); |
131 } | 131 } |
132 | 132 |
133 virtual void WorkerDestroyed(int process_id, int route_id) OVERRIDE { | 133 virtual void WorkerDestroyed(int process_id, int route_id) override { |
134 NotifyOnIOThread(); | 134 NotifyOnIOThread(); |
135 } | 135 } |
136 | 136 |
137 void StartOnIOThread() { | 137 void StartOnIOThread() { |
138 content::WorkerService::GetInstance()->AddObserver(this); | 138 content::WorkerService::GetInstance()->AddObserver(this); |
139 } | 139 } |
140 | 140 |
141 void StopOnIOThread() { | 141 void StopOnIOThread() { |
142 content::WorkerService::GetInstance()->RemoveObserver(this); | 142 content::WorkerService::GetInstance()->RemoveObserver(this); |
143 } | 143 } |
(...skipping 19 matching lines...) Expand all Loading... |
163 // LocalTargetsUIHandler --------------------------------------------- | 163 // LocalTargetsUIHandler --------------------------------------------- |
164 | 164 |
165 class LocalTargetsUIHandler | 165 class LocalTargetsUIHandler |
166 : public DevToolsTargetsUIHandler, | 166 : public DevToolsTargetsUIHandler, |
167 public content::NotificationObserver { | 167 public content::NotificationObserver { |
168 public: | 168 public: |
169 explicit LocalTargetsUIHandler(const Callback& callback); | 169 explicit LocalTargetsUIHandler(const Callback& callback); |
170 virtual ~LocalTargetsUIHandler(); | 170 virtual ~LocalTargetsUIHandler(); |
171 | 171 |
172 // DevToolsTargetsUIHandler overrides. | 172 // DevToolsTargetsUIHandler overrides. |
173 virtual void ForceUpdate() OVERRIDE; | 173 virtual void ForceUpdate() override; |
174 | 174 |
175 private: | 175 private: |
176 // content::NotificationObserver overrides. | 176 // content::NotificationObserver overrides. |
177 virtual void Observe(int type, | 177 virtual void Observe(int type, |
178 const content::NotificationSource& source, | 178 const content::NotificationSource& source, |
179 const content::NotificationDetails& details) OVERRIDE; | 179 const content::NotificationDetails& details) override; |
180 | 180 |
181 void ScheduleUpdate(); | 181 void ScheduleUpdate(); |
182 void UpdateTargets(); | 182 void UpdateTargets(); |
183 void SendTargets(const DevToolsTargetImpl::List& targets); | 183 void SendTargets(const DevToolsTargetImpl::List& targets); |
184 | 184 |
185 content::NotificationRegistrar notification_registrar_; | 185 content::NotificationRegistrar notification_registrar_; |
186 scoped_ptr<CancelableTimer> timer_; | 186 scoped_ptr<CancelableTimer> timer_; |
187 scoped_refptr<WorkerObserver> observer_; | 187 scoped_refptr<WorkerObserver> observer_; |
188 base::WeakPtrFactory<LocalTargetsUIHandler> weak_factory_; | 188 base::WeakPtrFactory<LocalTargetsUIHandler> weak_factory_; |
189 }; | 189 }; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 class AdbTargetsUIHandler | 276 class AdbTargetsUIHandler |
277 : public DevToolsTargetsUIHandler, | 277 : public DevToolsTargetsUIHandler, |
278 public DevToolsAndroidBridge::DeviceListListener { | 278 public DevToolsAndroidBridge::DeviceListListener { |
279 public: | 279 public: |
280 AdbTargetsUIHandler(const Callback& callback, Profile* profile); | 280 AdbTargetsUIHandler(const Callback& callback, Profile* profile); |
281 virtual ~AdbTargetsUIHandler(); | 281 virtual ~AdbTargetsUIHandler(); |
282 | 282 |
283 virtual void Open(const std::string& browser_id, | 283 virtual void Open(const std::string& browser_id, |
284 const std::string& url, | 284 const std::string& url, |
285 const DevToolsTargetsUIHandler::TargetCallback&) OVERRIDE; | 285 const DevToolsTargetsUIHandler::TargetCallback&) override; |
286 | 286 |
287 virtual scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( | 287 virtual scoped_refptr<content::DevToolsAgentHost> GetBrowserAgentHost( |
288 const std::string& browser_id) OVERRIDE; | 288 const std::string& browser_id) override; |
289 | 289 |
290 private: | 290 private: |
291 // DevToolsAndroidBridge::Listener overrides. | 291 // DevToolsAndroidBridge::Listener overrides. |
292 virtual void DeviceListChanged( | 292 virtual void DeviceListChanged( |
293 const DevToolsAndroidBridge::RemoteDevices& devices) OVERRIDE; | 293 const DevToolsAndroidBridge::RemoteDevices& devices) override; |
294 | 294 |
295 Profile* profile_; | 295 Profile* profile_; |
296 | 296 |
297 typedef std::map<std::string, | 297 typedef std::map<std::string, |
298 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> > RemoteBrowsers; | 298 scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> > RemoteBrowsers; |
299 RemoteBrowsers remote_browsers_; | 299 RemoteBrowsers remote_browsers_; |
300 }; | 300 }; |
301 | 301 |
302 AdbTargetsUIHandler::AdbTargetsUIHandler(const Callback& callback, | 302 AdbTargetsUIHandler::AdbTargetsUIHandler(const Callback& callback, |
303 Profile* profile) | 303 Profile* profile) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 device_status_dict->SetString(kPortForwardingBrowserId, | 525 device_status_dict->SetString(kPortForwardingBrowserId, |
526 SerializeBrowserId(sit->first)); | 526 SerializeBrowserId(sit->first)); |
527 | 527 |
528 std::string device_id = base::StringPrintf( | 528 std::string device_id = base::StringPrintf( |
529 kAdbDeviceIdFormat, | 529 kAdbDeviceIdFormat, |
530 sit->first->serial().c_str()); | 530 sit->first->serial().c_str()); |
531 result.Set(device_id, device_status_dict); | 531 result.Set(device_id, device_status_dict); |
532 } | 532 } |
533 callback_.Run(result); | 533 callback_.Run(result); |
534 } | 534 } |
OLD | NEW |