OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 |
| 14 namespace base { |
| 15 class Thread; |
| 16 } |
| 17 |
| 18 class DevToolsAdbBridge : public base::RefCountedThreadSafe<DevToolsAdbBridge> { |
| 19 public: |
| 20 typedef base::Callback<void(const std::string& error, |
| 21 const std::string& data)> Callback; |
| 22 |
| 23 static DevToolsAdbBridge* Start(); |
| 24 void Query(const std::string query, const Callback& callback); |
| 25 void Stop(); |
| 26 |
| 27 private: |
| 28 friend class base::RefCountedThreadSafe<DevToolsAdbBridge>; |
| 29 |
| 30 explicit DevToolsAdbBridge(); |
| 31 virtual ~DevToolsAdbBridge(); |
| 32 |
| 33 void StartHandlerOnFileThread(); |
| 34 void StopHandlerOnFileThread(); |
| 35 |
| 36 void ResetHandlerAndReleaseOnUIThread(); |
| 37 void ResetHandlerOnUIThread(); |
| 38 |
| 39 void QueryOnHandlerThread(const std::string query, const Callback& callback); |
| 40 void QueryResponseOnHandlerThread(const Callback& callback, |
| 41 const std::string& error, |
| 42 const std::string& response); |
| 43 |
| 44 void RespondOnUIThread(const Callback& callback, |
| 45 const std::string& error, |
| 46 const std::string& response); |
| 47 |
| 48 // The thread used by the devtools to run client socket. |
| 49 scoped_ptr<base::Thread> thread_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_ADB_BRIDGE_H_ |
OLD | NEW |