| Index: chrome/browser/extensions/api/debugger/debugger_api.cc
|
| diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
|
| index 6beea1bdd3721d4fab1d601751d250bf5a3f94c3..36e39db94f9c451beb14de78684fe0db2e672fd5 100644
|
| --- a/chrome/browser/extensions/api/debugger/debugger_api.cc
|
| +++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
|
| @@ -26,7 +26,6 @@
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| -#include "chrome/browser/devtools/chrome_devtools_manager_delegate.h"
|
| #include "chrome/browser/devtools/devtools_target_impl.h"
|
| #include "chrome/browser/devtools/global_confirm_info_bar.h"
|
| #include "chrome/browser/extensions/api/debugger/debugger_api_constants.h"
|
| @@ -674,35 +673,33 @@
|
| const char kTargetAttachedField[] = "attached";
|
| const char kTargetUrlField[] = "url";
|
| const char kTargetFaviconUrlField[] = "faviconUrl";
|
| +const char kTargetTypePage[] = "page";
|
| +const char kTargetTypeBackgroundPage[] = "background_page";
|
| +const char kTargetTypeWorker[] = "worker";
|
| +const char kTargetTypeOther[] = "other";
|
| const char kTargetTabIdField[] = "tabId";
|
| const char kTargetExtensionIdField[] = "extensionId";
|
| -const char kTargetTypeWorker[] = "worker";
|
|
|
| base::Value* SerializeTarget(const DevToolsTargetImpl& target) {
|
| base::DictionaryValue* dictionary = new base::DictionaryValue();
|
| - scoped_refptr<DevToolsAgentHost> host = target.GetAgentHost();
|
| - dictionary->SetString(kTargetIdField, host->GetId());
|
| - dictionary->SetString(kTargetTitleField, host->GetTitle());
|
| - dictionary->SetBoolean(kTargetAttachedField, host->IsAttached());
|
| - dictionary->SetString(kTargetUrlField, host->GetURL().spec());
|
| -
|
| - std::string type = host->GetType();
|
| - if (type == DevToolsAgentHost::kTypePage) {
|
| - int tab_id =
|
| - extensions::ExtensionTabUtil::GetTabId(host->GetWebContents());
|
| - dictionary->SetInteger(kTargetTabIdField, tab_id);
|
| - } else if (type == ChromeDevToolsManagerDelegate::kTypeBackgroundPage) {
|
| - dictionary->SetString(kTargetExtensionIdField, host->GetURL().host());
|
| - }
|
| -
|
| - if (type == DevToolsAgentHost::kTypeServiceWorker ||
|
| - type == DevToolsAgentHost::kTypeSharedWorker) {
|
| - type = kTargetTypeWorker;
|
| - }
|
| -
|
| +
|
| + dictionary->SetString(kTargetIdField, target.GetId());
|
| + dictionary->SetString(kTargetTitleField, target.GetTitle());
|
| + dictionary->SetBoolean(kTargetAttachedField, target.IsAttached());
|
| + dictionary->SetString(kTargetUrlField, target.GetURL().spec());
|
| +
|
| + std::string type = target.GetType();
|
| + if (type == kTargetTypePage) {
|
| + dictionary->SetInteger(kTargetTabIdField, target.GetTabId());
|
| + } else if (type == kTargetTypeBackgroundPage) {
|
| + dictionary->SetString(kTargetExtensionIdField, target.GetExtensionId());
|
| + } else if (type != kTargetTypeWorker) {
|
| + // DevToolsTargetImpl may support more types than the debugger API.
|
| + type = kTargetTypeOther;
|
| + }
|
| dictionary->SetString(kTargetTypeField, type);
|
|
|
| - GURL favicon_url = host->GetFaviconURL();
|
| + GURL favicon_url = target.GetFaviconURL();
|
| if (favicon_url.is_valid())
|
| dictionary->SetString(kTargetFaviconUrlField, favicon_url.spec());
|
|
|
|
|