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/location.h" |
7 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/single_thread_task_runner.h" |
8 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
9 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/thread_task_runner_handle.h" |
10 #include "base/values.h" | 13 #include "base/values.h" |
11 #include "base/version.h" | 14 #include "base/version.h" |
12 #include "chrome/browser/devtools/device/devtools_android_bridge.h" | 15 #include "chrome/browser/devtools/device/devtools_android_bridge.h" |
13 #include "chrome/browser/devtools/devtools_target_impl.h" | 16 #include "chrome/browser/devtools/devtools_target_impl.h" |
14 #include "chrome/common/chrome_version_info.h" | 17 #include "chrome/common/chrome_version_info.h" |
15 #include "content/public/browser/browser_child_process_observer.h" | 18 #include "content/public/browser/browser_child_process_observer.h" |
16 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/child_process_data.h" | 20 #include "content/public/browser/child_process_data.h" |
18 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const char kPortForwardingPorts[] = "ports"; | 65 const char kPortForwardingPorts[] = "ports"; |
63 const char kPortForwardingBrowserId[] = "browserId"; | 66 const char kPortForwardingBrowserId[] = "browserId"; |
64 | 67 |
65 // CancelableTimer ------------------------------------------------------------ | 68 // CancelableTimer ------------------------------------------------------------ |
66 | 69 |
67 class CancelableTimer { | 70 class CancelableTimer { |
68 public: | 71 public: |
69 CancelableTimer(base::Closure callback, base::TimeDelta delay) | 72 CancelableTimer(base::Closure callback, base::TimeDelta delay) |
70 : callback_(callback), | 73 : callback_(callback), |
71 weak_factory_(this) { | 74 weak_factory_(this) { |
72 base::MessageLoop::current()->PostDelayedTask( | 75 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
73 FROM_HERE, | 76 FROM_HERE, |
74 base::Bind(&CancelableTimer::Fire, weak_factory_.GetWeakPtr()), | 77 base::Bind(&CancelableTimer::Fire, weak_factory_.GetWeakPtr()), delay); |
75 delay); | |
76 } | 78 } |
77 | 79 |
78 private: | 80 private: |
79 void Fire() { callback_.Run(); } | 81 void Fire() { callback_.Run(); } |
80 | 82 |
81 base::Closure callback_; | 83 base::Closure callback_; |
82 base::WeakPtrFactory<CancelableTimer> weak_factory_; | 84 base::WeakPtrFactory<CancelableTimer> weak_factory_; |
83 }; | 85 }; |
84 | 86 |
85 // WorkerObserver ------------------------------------------------------------- | 87 // WorkerObserver ------------------------------------------------------------- |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 device_status_dict->SetString(kPortForwardingBrowserId, | 489 device_status_dict->SetString(kPortForwardingBrowserId, |
488 sit->first->GetId()); | 490 sit->first->GetId()); |
489 | 491 |
490 std::string device_id = base::StringPrintf( | 492 std::string device_id = base::StringPrintf( |
491 kAdbDeviceIdFormat, | 493 kAdbDeviceIdFormat, |
492 sit->first->serial().c_str()); | 494 sit->first->serial().c_str()); |
493 result.Set(device_id, device_status_dict); | 495 result.Set(device_id, device_status_dict); |
494 } | 496 } |
495 callback_.Run(result); | 497 callback_.Run(result); |
496 } | 498 } |
OLD | NEW |