OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/devtools/devtools_target_impl.h" | 5 #include "chrome/browser/devtools/devtools_target_impl.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 tab_id_ = extensions::ExtensionTabUtil::GetTabId(web_contents); | 77 tab_id_ = extensions::ExtensionTabUtil::GetTabId(web_contents); |
78 } else { | 78 } else { |
79 Profile* profile = | 79 Profile* profile = |
80 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 80 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
81 if (profile) { | 81 if (profile) { |
82 ExtensionService* extension_service = profile->GetExtensionService(); | 82 ExtensionService* extension_service = profile->GetExtensionService(); |
83 const extensions::Extension* extension = extension_service-> | 83 const extensions::Extension* extension = extension_service-> |
84 extensions()->GetByID(url_.host()); | 84 extensions()->GetByID(url_.host()); |
85 if (extension) { | 85 if (extension) { |
86 title_ = extension->name(); | 86 title_ = extension->name(); |
87 if (extension->is_hosted_app() | 87 extensions::ExtensionHost* extension_host = |
| 88 extensions::ExtensionSystem::Get(profile)->process_manager()-> |
| 89 GetBackgroundHostForExtension(extension->id()); |
| 90 if (extension_host && |
| 91 extension_host->host_contents() == web_contents) { |
| 92 type_ = kTargetTypeBackgroundPage; |
| 93 extension_id_ = extension->id(); |
| 94 } else if (extension->is_hosted_app() |
88 || extension->is_legacy_packaged_app() | 95 || extension->is_legacy_packaged_app() |
89 || extension->is_platform_app()) { | 96 || extension->is_platform_app()) { |
90 type_ = kTargetTypeApp; | 97 type_ = kTargetTypeApp; |
91 } else { | |
92 extensions::ExtensionHost* extension_host = | |
93 extensions::ExtensionSystem::Get(profile)->process_manager()-> | |
94 GetBackgroundHostForExtension(extension->id()); | |
95 if (extension_host && | |
96 extension_host->host_contents() == web_contents) { | |
97 type_ = kTargetTypeBackgroundPage; | |
98 extension_id_ = extension->id(); | |
99 } | |
100 } | 98 } |
101 favicon_url_ = extensions::ExtensionIconSource::GetIconURL( | 99 favicon_url_ = extensions::ExtensionIconSource::GetIconURL( |
102 extension, extension_misc::EXTENSION_ICON_SMALLISH, | 100 extension, extension_misc::EXTENSION_ICON_SMALLISH, |
103 ExtensionIconSet::MATCH_BIGGER, false, NULL); | 101 ExtensionIconSet::MATCH_BIGGER, false, NULL); |
104 } | 102 } |
105 } | 103 } |
106 } | 104 } |
107 } | 105 } |
108 | 106 |
109 bool RenderViewHostTarget::Activate() const { | 107 bool RenderViewHostTarget::Activate() const { |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 322 |
325 // static | 323 // static |
326 void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { | 324 void DevToolsTargetImpl::EnumerateAllTargets(Callback callback) { |
327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 325 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
328 content::BrowserThread::PostTask( | 326 content::BrowserThread::PostTask( |
329 content::BrowserThread::IO, | 327 content::BrowserThread::IO, |
330 FROM_HERE, | 328 FROM_HERE, |
331 base::Bind(&DevToolsTargetImpl::EnumerateWorkerTargets, | 329 base::Bind(&DevToolsTargetImpl::EnumerateWorkerTargets, |
332 base::Bind(&CollectAllTargets, callback))); | 330 base::Bind(&CollectAllTargets, callback))); |
333 } | 331 } |
OLD | NEW |