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

Unified Diff: chrome/browser/devtools/device/devtools_android_bridge.h

Issue 2361613002: DevTools: untangle device discovery request from the devtools android bridge. (Closed)
Patch Set: for landing Created 4 years, 3 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/device/devtools_android_bridge.h
diff --git a/chrome/browser/devtools/device/devtools_android_bridge.h b/chrome/browser/devtools/device/devtools_android_bridge.h
index 8a370c90dcd8897ffa09ca5d631ffc1bd148080c..4841434d290e5d0c579005af210b10758fdc609a 100644
--- a/chrome/browser/devtools/device/devtools_android_bridge.h
+++ b/chrome/browser/devtools/device/devtools_android_bridge.h
@@ -60,23 +60,25 @@ class DevToolsAndroidBridge : public KeyedService {
DISALLOW_COPY_AND_ASSIGN(Factory);
};
- using BrowserId = std::pair<std::string, std::string>;
-
class RemotePage : public base::RefCounted<RemotePage> {
public:
- const std::string& serial() { return browser_id_.first; }
- const std::string& socket() { return browser_id_.second; }
+ scoped_refptr<AndroidDeviceManager::Device> device() { return device_; }
+ const std::string& socket() { return browser_id_; }
const std::string& frontend_url() { return frontend_url_; }
+ scoped_refptr<content::DevToolsAgentHost> CreateTarget();
private:
friend class base::RefCounted<RemotePage>;
friend class DevToolsAndroidBridge;
- RemotePage(const BrowserId& browser_id, const base::DictionaryValue& dict);
+ RemotePage(scoped_refptr<AndroidDeviceManager::Device> device,
+ const std::string& browser_id,
+ const base::DictionaryValue& dict);
virtual ~RemotePage();
- BrowserId browser_id_;
+ scoped_refptr<AndroidDeviceManager::Device> device_;
+ std::string browser_id_;
std::string frontend_url_;
std::unique_ptr<base::DictionaryValue> dict_;
@@ -88,8 +90,8 @@ class DevToolsAndroidBridge : public KeyedService {
class RemoteBrowser : public base::RefCounted<RemoteBrowser> {
public:
- const std::string& serial() { return browser_id_.first; }
- const std::string& socket() { return browser_id_.second; }
+ const std::string& serial() { return serial_; }
+ const std::string& socket() { return browser_id_; }
const std::string& display_name() { return display_name_; }
const std::string& user() { return user_; }
const std::string& version() { return version_; }
@@ -110,7 +112,8 @@ class DevToolsAndroidBridge : public KeyedService {
virtual ~RemoteBrowser();
- BrowserId browser_id_;
+ std::string serial_;
+ std::string browser_id_;
std::string display_name_;
std::string user_;
AndroidDeviceManager::BrowserInfo::Type type_;
@@ -200,12 +203,6 @@ class DevToolsAndroidBridge : public KeyedService {
task_scheduler_ = scheduler;
}
- bool HasDevToolsWindow(const std::string& agent_id);
-
- // Creates new target instance owned by caller.
- scoped_refptr<content::DevToolsAgentHost>
- CreatePageTarget(scoped_refptr<RemotePage> browser);
-
using RemotePageCallback = base::Callback<void(scoped_refptr<RemotePage>)>;
void OpenRemotePage(scoped_refptr<RemoteBrowser> browser,
const std::string& url);
@@ -253,21 +250,6 @@ class DevToolsAndroidBridge : public KeyedService {
void CreateDeviceProviders();
- void SendJsonRequest(const BrowserId& browser_id,
- const std::string& url,
- const JsonRequestCallback& callback);
-
- void SendProtocolCommand(const BrowserId& browser_id,
- const std::string& target_path,
- const std::string& method,
- std::unique_ptr<base::DictionaryValue> params,
- const base::Closure callback);
-
- AndroidDeviceManager::AndroidWebSocket* CreateWebSocket(
- const BrowserId& browser_id,
- const std::string& url,
- AndroidDeviceManager::AndroidWebSocket::Delegate* delegate);
-
base::WeakPtr<DevToolsAndroidBridge> AsWeakPtr() {
return weak_factory_.GetWeakPtr();
}
@@ -279,9 +261,6 @@ class DevToolsAndroidBridge : public KeyedService {
std::map<std::string, scoped_refptr<AndroidDeviceManager::Device> >;
DeviceMap device_map_;
- using AgentHostDelegates = std::map<std::string, AgentHostDelegate*>;
- AgentHostDelegates host_delegates_;
-
using DeviceListListeners = std::vector<DeviceListListener*>;
DeviceListListeners device_list_listeners_;
base::CancelableCallback<void(const CompleteDevices&)> device_list_callback_;

Powered by Google App Engine
This is Rietveld 408576698