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

Unified Diff: chrome/browser/devtools/devtools_targets_ui.cc

Issue 2263843002: DevTools: merge devtools target with devtools host, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing 3 Created 4 years, 4 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
« no previous file with comments | « chrome/browser/devtools/devtools_target_impl.cc ('k') | chrome/browser/devtools/devtools_ui_bindings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « chrome/browser/devtools/devtools_target_impl.cc ('k') | chrome/browser/devtools/devtools_ui_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698