Index: chrome/browser/devtools/device/devtools_android_bridge.cc |
diff --git a/chrome/browser/devtools/device/devtools_android_bridge.cc b/chrome/browser/devtools/device/devtools_android_bridge.cc |
index c850b5cccd5e48a8ce6c44c99b0f44ad4e675101..58f64b9e5406d440c62cb307b5c1d2fe93e09ec9 100644 |
--- a/chrome/browser/devtools/device/devtools_android_bridge.cc |
+++ b/chrome/browser/devtools/device/devtools_android_bridge.cc |
@@ -57,6 +57,8 @@ const char kPageNavigateCommand[] = "Page.navigate"; |
const int kMinVersionNewWithURL = 32; |
const int kNewPageNavigateDelayMs = 500; |
+static int last_remote_browser_id_ = 1; |
+ |
// DiscoveryRequest ----------------------------------------------------- |
class DiscoveryRequest : public base::RefCountedThreadSafe< |
@@ -409,11 +411,12 @@ class RemotePageTarget : public DevToolsTargetImpl, |
void Navigate(const std::string& url, base::Closure callback) const; |
private: |
- scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_; |
- std::string debug_url_; |
+ const scoped_refptr<DevToolsAndroidBridge::RemoteBrowser> browser_; |
+ const std::string debug_url_; |
std::string frontend_url_; |
- std::string remote_id_; |
- std::string remote_type_; |
+ const std::string remote_id_; |
+ const std::string local_id_; |
+ const std::string remote_type_; |
DISALLOW_COPY_AND_ASSIGN(RemotePageTarget); |
}; |
@@ -450,6 +453,7 @@ RemotePageTarget::RemotePageTarget( |
browser_(browser), |
debug_url_(GetDebugURL(value)), |
SeRya
2014/08/29 07:04:41
Initialized twice.
|
remote_id_(GetStringProperty(value, "id")), |
+ local_id_(base::IntToString(browser->GetId()) + ":" + remote_id_), |
remote_type_(GetStringProperty(value, "type")) { |
set_type("adb_page"); |
set_url(GURL(GetStringProperty(value, "url"))); |
@@ -457,7 +461,6 @@ RemotePageTarget::RemotePageTarget( |
GetStringProperty(value, "title"))))); |
set_description(GetStringProperty(value, "description")); |
set_favicon_url(GURL(GetStringProperty(value, "faviconUrl"))); |
- debug_url_ = GetDebugURL(value); |
frontend_url_ = GetStringProperty(value, "devtoolsFrontendUrl"); |
size_t ws_param = frontend_url_.find("?ws"); |
@@ -479,7 +482,7 @@ std::string RemotePageTarget::GetFrontendURL() { |
} |
std::string RemotePageTarget::GetId() const { |
- return remote_id_; |
+ return local_id_; |
} |
bool RemotePageTarget::IsAttached() const { |
@@ -528,7 +531,8 @@ void RemotePageTarget::Navigate(const std::string& url, |
DevToolsAndroidBridge::RemoteBrowser::RemoteBrowser( |
scoped_refptr<Device> device, |
const AndroidDeviceManager::BrowserInfo& browser_info) |
- : device_(device), |
+ : id_(last_remote_browser_id_++), |
+ device_(device), |
socket_(browser_info.socket_name), |
display_name_(browser_info.display_name), |
type_(browser_info.type), |