Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2206)

Unified Diff: chrome/browser/devtools/devtools_adb_bridge.h

Issue 18137007: DevTools: add about:flag for ADB-less remote debugging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 4f12770e8e3fc62967114046cf57f1ad2258b6c7..cb47eedd1a129ad7e71899c22ac9a6a6398aa5cc 100644
--- a/chrome/browser/devtools/devtools_adb_bridge.h
+++ b/chrome/browser/devtools/devtools_adb_bridge.h
@@ -12,14 +12,26 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.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 "net/socket/tcp_client_socket.h"
+template<typename T> struct DefaultSingletonTraits;
+
namespace base {
class MessageLoop;
class DictionaryValue;
class Thread;
}
+namespace content {
+class BrowserContext;
+}
+
+namespace crypto {
+class RSAPrivateKey;
+}
+
class Profile;
// The format used for constructing DevTools server socket names.
@@ -28,10 +40,29 @@ extern const char kDevToolsChannelNameFormat[];
typedef base::Callback<void(int, const std::string&)> CommandCallback;
typedef base::Callback<void(int result, net::StreamSocket*)> SocketCallback;
-class DevToolsAdbBridge {
+class DevToolsAdbBridge : public BrowserContextKeyedService {
public:
typedef base::Callback<void(int result,
const std::string& response)> Callback;
+ class Factory : public BrowserContextKeyedServiceFactory {
+ public:
+ // Returns singleton instance of DevToolsAdbBridge.
+ static Factory* GetInstance();
+
+ // Returns DevToolsAdbBridge associated with |profile|.
+ static DevToolsAdbBridge* GetForProfile(Profile* profile);
+
+ private:
+ friend struct DefaultSingletonTraits<Factory>;
+
+ Factory();
+ virtual ~Factory();
+
+ // BrowserContextKeyedServiceFactory overrides:
+ virtual BrowserContextKeyedService* BuildServiceInstanceFor(
+ content::BrowserContext* context) const OVERRIDE;
+ DISALLOW_COPY_AND_ASSIGN(Factory);
+ };
class RemotePage : public base::RefCounted<RemotePage> {
public:
@@ -113,9 +144,13 @@ class DevToolsAdbBridge {
DISALLOW_COPY_AND_ASSIGN(AndroidDevice);
};
+ typedef std::vector<scoped_refptr<AndroidDevice> > AndroidDevices;
+ typedef base::Callback<void(const AndroidDevices&)> AndroidDevicesCallback;
+
explicit DevToolsAdbBridge(Profile* profile);
- ~DevToolsAdbBridge();
+ virtual ~DevToolsAdbBridge();
+ void EnumerateDevices(const AndroidDevicesCallback& callback);
void Query(const std::string query, const Callback& callback);
void Pages(const PagesCallback& callback);
void Attach(const std::string& serial,
@@ -124,6 +159,8 @@ class DevToolsAdbBridge {
const std::string& frontend_url);
private:
+ friend class base::RefCounted<DevToolsAdbBridge>;
vsevik 2013/07/11 15:59:54 nuke
pfeldman 2013/07/11 16:26:51 Done.
+
friend class AdbAttachCommand;
friend class AgentHostDelegate;
@@ -142,10 +179,15 @@ class DevToolsAdbBridge {
base::Thread* thread_;
};
+ void ReceivedDevices(const AndroidDevicesCallback& callback,
+ int result,
+ const std::string& response);
+
Profile* profile_;
scoped_refptr<RefCountedAdbThread> adb_thread_;
base::WeakPtrFactory<DevToolsAdbBridge> weak_factory_;
bool has_message_loop_;
+ scoped_ptr<crypto::RSAPrivateKey> rsa_key_;
DISALLOW_COPY_AND_ASSIGN(DevToolsAdbBridge);
};

Powered by Google App Engine
This is Rietveld 408576698