| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "net/socket/tcp_client_socket.h" | 15 #include "net/socket/tcp_client_socket.h" |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class MessageLoop; |
| 19 class DictionaryValue; |
| 18 class Thread; | 20 class Thread; |
| 19 class DictionaryValue; | |
| 20 } | 21 } |
| 21 | 22 |
| 22 class MessageLoop; | |
| 23 class Profile; | 23 class Profile; |
| 24 | 24 |
| 25 class DevToolsAdbBridge { | 25 class DevToolsAdbBridge { |
| 26 public: | 26 public: |
| 27 typedef base::Callback<void(int result, | 27 typedef base::Callback<void(int result, |
| 28 const std::string& response)> Callback; | 28 const std::string& response)> Callback; |
| 29 | 29 |
| 30 class RemotePage : public base::RefCounted<RemotePage> { | 30 class RemotePage : public base::RefCounted<RemotePage> { |
| 31 public: | 31 public: |
| 32 RemotePage(const std::string& serial, | 32 RemotePage(const std::string& serial, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 const std::string& frontend_url); | 71 const std::string& frontend_url); |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 friend class AdbAttachCommand; | 74 friend class AdbAttachCommand; |
| 75 friend class AgentHostDelegate; | 75 friend class AgentHostDelegate; |
| 76 | 76 |
| 77 class RefCountedAdbThread : public base::RefCounted<RefCountedAdbThread> { | 77 class RefCountedAdbThread : public base::RefCounted<RefCountedAdbThread> { |
| 78 public: | 78 public: |
| 79 static scoped_refptr<RefCountedAdbThread> GetInstance(); | 79 static scoped_refptr<RefCountedAdbThread> GetInstance(); |
| 80 RefCountedAdbThread(); | 80 RefCountedAdbThread(); |
| 81 MessageLoop* message_loop(); | 81 base::MessageLoop* message_loop(); |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 friend class base::RefCounted<RefCountedAdbThread>; | 84 friend class base::RefCounted<RefCountedAdbThread>; |
| 85 static DevToolsAdbBridge::RefCountedAdbThread* instance_; | 85 static DevToolsAdbBridge::RefCountedAdbThread* instance_; |
| 86 static void StopThread(base::Thread* thread); | 86 static void StopThread(base::Thread* thread); |
| 87 | 87 |
| 88 virtual ~RefCountedAdbThread(); | 88 virtual ~RefCountedAdbThread(); |
| 89 base::Thread* thread_; | 89 base::Thread* thread_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 Profile* profile_; | 92 Profile* profile_; |
| 93 scoped_refptr<RefCountedAdbThread> adb_thread_; | 93 scoped_refptr<RefCountedAdbThread> adb_thread_; |
| 94 base::WeakPtrFactory<DevToolsAdbBridge> weak_factory_; | 94 base::WeakPtrFactory<DevToolsAdbBridge> weak_factory_; |
| 95 bool has_message_loop_; | 95 bool has_message_loop_; |
| 96 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); | 96 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ | 99 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
| OLD | NEW |