OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class StreamSocket; | 17 class StreamSocket; |
18 } | 18 } |
19 | 19 |
20 class AndroidDeviceManager | 20 class AndroidDeviceManager |
21 : public base::RefCountedThreadSafe<AndroidDeviceManager>, | 21 : public base::RefCountedThreadSafe< |
| 22 AndroidDeviceManager, |
| 23 content::BrowserThread::DeleteOnUIThread>, |
22 public base::NonThreadSafe { | 24 public base::NonThreadSafe { |
23 public: | 25 public: |
24 typedef base::Callback<void(int, const std::string&)> CommandCallback; | 26 typedef base::Callback<void(int, const std::string&)> CommandCallback; |
25 typedef base::Callback<void(int result, net::StreamSocket*)> SocketCallback; | 27 typedef base::Callback<void(int result, net::StreamSocket*)> SocketCallback; |
26 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback; | 28 typedef base::Callback<void(const std::vector<std::string>&)> SerialsCallback; |
27 | 29 |
28 struct BrowserInfo { | 30 struct BrowserInfo { |
29 BrowserInfo(); | 31 BrowserInfo(); |
30 | 32 |
31 enum Type { | 33 enum Type { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 private: | 191 private: |
190 friend class base::RefCountedThreadSafe<HandlerThread>; | 192 friend class base::RefCountedThreadSafe<HandlerThread>; |
191 static HandlerThread* instance_; | 193 static HandlerThread* instance_; |
192 static void StopThread(base::Thread* thread); | 194 static void StopThread(base::Thread* thread); |
193 | 195 |
194 HandlerThread(); | 196 HandlerThread(); |
195 virtual ~HandlerThread(); | 197 virtual ~HandlerThread(); |
196 base::Thread* thread_; | 198 base::Thread* thread_; |
197 }; | 199 }; |
198 | 200 |
199 friend class base::RefCountedThreadSafe<AndroidDeviceManager>; | 201 friend struct content::BrowserThread::DeleteOnThread< |
| 202 content::BrowserThread::UI>; |
| 203 friend class base::DeleteHelper<AndroidDeviceManager>; |
200 AndroidDeviceManager(); | 204 AndroidDeviceManager(); |
201 virtual ~AndroidDeviceManager(); | 205 virtual ~AndroidDeviceManager(); |
202 | 206 |
203 void UpdateDevices(const DevicesCallback& callback, | 207 void UpdateDevices(const DevicesCallback& callback, |
204 DeviceDescriptors* descriptors); | 208 DeviceDescriptors* descriptors); |
205 | 209 |
206 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; | 210 typedef std::map<std::string, base::WeakPtr<Device> > DeviceWeakMap; |
207 | 211 |
208 scoped_refptr<HandlerThread> handler_thread_; | 212 scoped_refptr<HandlerThread> handler_thread_; |
209 DeviceProviders providers_; | 213 DeviceProviders providers_; |
210 DeviceWeakMap devices_; | 214 DeviceWeakMap devices_; |
211 }; | 215 }; |
212 | 216 |
213 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ | 217 #endif // CHROME_BROWSER_DEVTOOLS_DEVICE_ANDROID_DEVICE_MANAGER_H_ |
OLD | NEW |