Index: chrome/browser/devtools/devtools_targets_ui.cc |
diff --git a/chrome/browser/devtools/devtools_targets_ui.cc b/chrome/browser/devtools/devtools_targets_ui.cc |
index a332096dd027004bec186846fc78b7bcc730ef6a..bf405f30362f38942e96b6401806d290ef841370 100644 |
--- a/chrome/browser/devtools/devtools_targets_ui.cc |
+++ b/chrome/browser/devtools/devtools_targets_ui.cc |
@@ -236,14 +236,16 @@ void LocalTargetsUIHandler::SendTargets( |
base::STLDeleteValues(&targets_); |
for (DevToolsTargetImpl* target : targets) { |
- targets_[target->GetId()] = target; |
- id_to_descriptor[target->GetId()] = Serialize(*target); |
+ scoped_refptr<content::DevToolsAgentHost> host = target->GetAgentHost(); |
+ targets_[host->GetId()] = target; |
+ id_to_descriptor[host->GetId()] = Serialize(*target); |
} |
for (TargetMap::iterator it(targets_.begin()); it != targets_.end(); ++it) { |
DevToolsTargetImpl* target = it->second; |
- base::DictionaryValue* descriptor = id_to_descriptor[target->GetId()]; |
- std::string parent_id = target->GetParentId(); |
+ scoped_refptr<content::DevToolsAgentHost> host = target->GetAgentHost(); |
+ base::DictionaryValue* descriptor = id_to_descriptor[host->GetId()]; |
+ std::string parent_id = host->GetParentId(); |
if (parent_id.empty() || id_to_descriptor.count(parent_id) == 0) { |
list_value.Append(descriptor); |
} else { |
@@ -367,18 +369,19 @@ void AdbTargetsUIHandler::DeviceListChanged( |
browser_data->Set(kAdbPagesList, page_list); |
for (const auto& page : browser->pages()) { |
DevToolsTargetImpl* target = android_bridge_->CreatePageTarget(page); |
+ scoped_refptr<content::DevToolsAgentHost> host = target->GetAgentHost(); |
base::DictionaryValue* target_data = Serialize(*target); |
target_data->SetBoolean( |
kAdbAttachedForeignField, |
- target->IsAttached() && |
- !android_bridge_->HasDevToolsWindow(target->GetId())); |
+ host->IsAttached() && |
+ !android_bridge_->HasDevToolsWindow(host->GetId())); |
// Pass the screen size in the target object to make sure that |
// the caching logic does not prevent the target item from updating |
// when the screen size changes. |
gfx::Size screen_size = device->screen_size(); |
target_data->SetInteger(kAdbScreenWidthField, screen_size.width()); |
target_data->SetInteger(kAdbScreenHeightField, screen_size.height()); |
- targets_[target->GetId()] = target; |
+ targets_[host->GetId()] = target; |
page_list->Append(target_data); |
} |
browser_list->Append(std::move(browser_data)); |
@@ -441,14 +444,15 @@ DevToolsTargetsUIHandler::GetBrowserAgentHost(const std::string& browser_id) { |
base::DictionaryValue* DevToolsTargetsUIHandler::Serialize( |
const DevToolsTargetImpl& target) { |
base::DictionaryValue* target_data = new base::DictionaryValue(); |
+ scoped_refptr<content::DevToolsAgentHost> host = target.GetAgentHost(); |
target_data->SetString(kTargetSourceField, source_id_); |
- target_data->SetString(kTargetIdField, target.GetId()); |
- target_data->SetString(kTargetTypeField, target.GetType()); |
- target_data->SetBoolean(kAttachedField, target.IsAttached()); |
- target_data->SetString(kUrlField, target.GetURL().spec()); |
- target_data->SetString(kNameField, target.GetTitle()); |
- target_data->SetString(kFaviconUrlField, target.GetFaviconURL().spec()); |
- target_data->SetString(kDescriptionField, target.GetDescription()); |
+ target_data->SetString(kTargetIdField, host->GetId()); |
+ target_data->SetString(kTargetTypeField, host->GetType()); |
+ target_data->SetBoolean(kAttachedField, host->IsAttached()); |
+ target_data->SetString(kUrlField, host->GetURL().spec()); |
+ target_data->SetString(kNameField, host->GetTitle()); |
+ target_data->SetString(kFaviconUrlField, host->GetFaviconURL().spec()); |
+ target_data->SetString(kDescriptionField, host->GetDescription()); |
return target_data; |
} |