Chromium Code Reviews| Index: chrome/browser/devtools/devtools_adb_bridge.h |
| diff --git a/chrome/browser/devtools/devtools_adb_bridge.h b/chrome/browser/devtools/devtools_adb_bridge.h |
| index 0273e081d7396d3e3846a5341fba11fd7b629715..5c44766d907bd173b7e304c3c192e2d2b6d63712 100644 |
| --- a/chrome/browser/devtools/devtools_adb_bridge.h |
| +++ b/chrome/browser/devtools/devtools_adb_bridge.h |
| @@ -12,6 +12,8 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "chrome/browser/devtools/adb/android_usb_device.h" |
|
Vladislav Kaznacheev
2013/10/17 20:17:37
Is this header still required?
Dmitry Zvorygin
2013/10/21 07:40:29
Done.
|
| +#include "chrome/browser/devtools/devtools_device_provider.h" |
| +#include "chrome/browser/devtools/refcounted_adb_thread.h" |
| #include "components/browser_context_keyed_service/browser_context_keyed_service.h" |
| #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -39,14 +41,12 @@ class Profile; |
| // The format used for constructing DevTools server socket names. |
| extern const char kDevToolsChannelNameFormat[]; |
| -typedef base::Callback<void(int, const std::string&)> CommandCallback; |
| -typedef base::Callback<void(int result, net::StreamSocket*)> SocketCallback; |
| - |
| class DevToolsAdbBridge |
| : public base::RefCountedThreadSafe< |
| DevToolsAdbBridge, |
| content::BrowserThread::DeleteOnUIThread> { |
| public: |
| + typedef std::vector<scoped_refptr<DevToolsDeviceProvider> > DeviceProviders; |
| typedef base::Callback<void(int result, |
| const std::string& response)> Callback; |
| @@ -80,12 +80,9 @@ class DevToolsAdbBridge |
| DISALLOW_COPY_AND_ASSIGN(Factory); |
| }; |
| - class AndroidDevice; |
| - class RefCountedAdbThread; |
| - |
| - class RemotePage : public base::RefCounted<RemotePage> { |
| + class RemotePage : public base::RefCounted<RemotePage> { |
| public: |
| - RemotePage(scoped_refptr<DevToolsAdbBridge::RefCountedAdbThread> adb_thread, |
| + RemotePage(scoped_refptr<RefCountedAdbThread> adb_thread, |
| scoped_refptr<AndroidDevice> device, |
| const std::string& socket, |
| const base::DictionaryValue& value); |
| @@ -111,14 +108,14 @@ class DevToolsAdbBridge |
| friend class base::RefCounted<RemotePage>; |
| virtual ~RemotePage(); |
| - void RequestActivate(const CommandCallback& callback); |
| + void RequestActivate(const AndroidDevice::CommandCallback& callback); |
| void InspectOnHandlerThread( |
| Profile* profile, int result, const std::string& response); |
| void InspectOnUIThread(Profile* profile); |
| - scoped_refptr<DevToolsAdbBridge::RefCountedAdbThread> adb_thread_; |
| + scoped_refptr<RefCountedAdbThread> adb_thread_; |
| scoped_refptr<AndroidDevice> device_; |
| std::string socket_; |
| std::string id_; |
| @@ -137,7 +134,7 @@ class DevToolsAdbBridge |
| class RemoteBrowser : public base::RefCounted<RemoteBrowser> { |
| public: |
| RemoteBrowser( |
| - scoped_refptr<DevToolsAdbBridge::RefCountedAdbThread> adb_thread, |
| + scoped_refptr<RefCountedAdbThread> adb_thread, |
| scoped_refptr<AndroidDevice> device, |
| const std::string& socket); |
| @@ -168,7 +165,7 @@ class DevToolsAdbBridge |
| void PageCreatedOnUIThread( |
| const std::string& response, const std::string& url); |
| - scoped_refptr<DevToolsAdbBridge::RefCountedAdbThread> adb_thread_; |
| + scoped_refptr<RefCountedAdbThread> adb_thread_; |
| scoped_refptr<AndroidDevice> device_; |
| const std::string socket_; |
| std::string product_; |
| @@ -209,47 +206,6 @@ class DevToolsAdbBridge |
| typedef std::vector<scoped_refptr<RemoteDevice> > RemoteDevices; |
| - class AndroidDevice : public base::RefCounted<AndroidDevice> { |
| - public: |
| - explicit AndroidDevice(const std::string& serial); |
| - |
| - virtual void RunCommand(const std::string& command, |
| - const CommandCallback& callback) = 0; |
| - virtual void OpenSocket(const std::string& socket_name, |
| - const SocketCallback& callback) = 0; |
| - virtual bool IsConnected() = 0; |
| - void HttpQuery(const std::string& la_name, |
| - const std::string& request, |
| - const CommandCallback& callback); |
| - void HttpUpgrade(const std::string& la_name, |
| - const std::string& request, |
| - const SocketCallback& callback); |
| - |
| - std::string serial() { return serial_; } |
| - |
| - std::string model() { return model_; } |
| - void set_model(const std::string& model) { model_ = model; } |
| - |
| - protected: |
| - friend class base::RefCounted<AndroidDevice>; |
| - virtual ~AndroidDevice(); |
| - |
| - private: |
| - void OnHttpSocketOpened(const std::string& request, |
| - const CommandCallback& callback, |
| - int result, |
| - net::StreamSocket* socket); |
| - void OnHttpSocketOpened2(const std::string& request, |
| - const SocketCallback& callback, |
| - int result, |
| - net::StreamSocket* socket); |
| - |
| - std::string serial_; |
| - std::string model_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(AndroidDevice); |
| - }; |
| - |
| typedef std::vector<scoped_refptr<AndroidDevice> > AndroidDevices; |
| typedef base::Callback<void(const AndroidDevices&)> AndroidDevicesCallback; |
| @@ -260,21 +216,6 @@ class DevToolsAdbBridge |
| virtual ~Listener() {} |
| }; |
| - class RefCountedAdbThread : public base::RefCounted<RefCountedAdbThread> { |
| - public: |
| - static scoped_refptr<RefCountedAdbThread> GetInstance(); |
| - base::MessageLoop* message_loop(); |
| - |
| - private: |
| - friend class base::RefCounted<RefCountedAdbThread>; |
| - static DevToolsAdbBridge::RefCountedAdbThread* instance_; |
| - static void StopThread(base::Thread* thread); |
| - |
| - RefCountedAdbThread(); |
| - virtual ~RefCountedAdbThread(); |
| - base::Thread* thread_; |
| - }; |
| - |
| explicit DevToolsAdbBridge(Profile* profile); |
| void AddListener(Listener* listener); |
| void RemoveListener(Listener* listener); |
| @@ -296,7 +237,6 @@ class DevToolsAdbBridge |
| Profile* profile_; |
| scoped_refptr<RefCountedAdbThread> adb_thread_; |
| bool has_message_loop_; |
| - scoped_ptr<crypto::RSAPrivateKey> rsa_key_; |
| typedef std::vector<Listener*> Listeners; |
| Listeners listeners_; |
| bool discover_usb_devices_; |