| 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_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 13 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 13 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/favicon_status.h" | 16 #include "content/public/browser/favicon_status.h" |
| 17 #include "content/public/browser/navigation_entry.h" | 17 #include "content/public/browser/navigation_entry.h" |
| 18 #include "content/public/browser/render_frame_host.h" | 18 #include "content/public/browser/render_frame_host.h" |
| 19 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "extensions/browser/extension_host.h" | 21 #include "extensions/browser/extension_host.h" |
| 22 #include "extensions/browser/extension_registry.h" | 22 #include "extensions/browser/extension_registry.h" |
| 23 #include "extensions/browser/extension_system.h" | |
| 24 #include "extensions/browser/guest_view/guest_view_base.h" | 23 #include "extensions/browser/guest_view/guest_view_base.h" |
| 25 #include "extensions/browser/process_manager.h" | 24 #include "extensions/browser/process_manager.h" |
| 26 #include "extensions/common/constants.h" | 25 #include "extensions/common/constants.h" |
| 27 | 26 |
| 28 using content::BrowserThread; | 27 using content::BrowserThread; |
| 29 using content::DevToolsAgentHost; | 28 using content::DevToolsAgentHost; |
| 30 using content::RenderViewHost; | 29 using content::RenderViewHost; |
| 31 using content::WebContents; | 30 using content::WebContents; |
| 32 using content::WorkerService; | 31 using content::WorkerService; |
| 33 | 32 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const extensions::Extension* extension = extensions::ExtensionRegistry::Get( | 99 const extensions::Extension* extension = extensions::ExtensionRegistry::Get( |
| 101 web_contents->GetBrowserContext())->enabled_extensions().GetByID( | 100 web_contents->GetBrowserContext())->enabled_extensions().GetByID( |
| 102 GetURL().host()); | 101 GetURL().host()); |
| 103 if (!extension) | 102 if (!extension) |
| 104 return; | 103 return; |
| 105 | 104 |
| 106 Profile* profile = | 105 Profile* profile = |
| 107 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 106 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 108 if (!profile) | 107 if (!profile) |
| 109 return; | 108 return; |
| 110 extensions::ExtensionSystem* extension_system = | |
| 111 extensions::ExtensionSystem::Get(profile); | |
| 112 set_title(extension->name()); | 109 set_title(extension->name()); |
| 113 extensions::ExtensionHost* extension_host = | 110 extensions::ExtensionHost* extension_host = |
| 114 extension_system->process_manager()->GetBackgroundHostForExtension( | 111 extensions::ProcessManager::Get(profile) |
| 115 extension->id()); | 112 ->GetBackgroundHostForExtension(extension->id()); |
| 116 if (extension_host && | 113 if (extension_host && |
| 117 extension_host->host_contents() == web_contents) { | 114 extension_host->host_contents() == web_contents) { |
| 118 set_type(kTargetTypeBackgroundPage); | 115 set_type(kTargetTypeBackgroundPage); |
| 119 extension_id_ = extension->id(); | 116 extension_id_ = extension->id(); |
| 120 } else if (extension->is_hosted_app() | 117 } else if (extension->is_hosted_app() |
| 121 || extension->is_legacy_packaged_app() | 118 || extension->is_legacy_packaged_app() |
| 122 || extension->is_platform_app()) { | 119 || extension->is_platform_app()) { |
| 123 set_type(kTargetTypeApp); | 120 set_type(kTargetTypeApp); |
| 124 } | 121 } |
| 125 set_favicon_url(extensions::ExtensionIconSource::GetIconURL( | 122 set_favicon_url(extensions::ExtensionIconSource::GetIconURL( |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 case DevToolsAgentHost::TYPE_SERVICE_WORKER: | 287 case DevToolsAgentHost::TYPE_SERVICE_WORKER: |
| 291 result.push_back(new WorkerTarget(agent_host)); | 288 result.push_back(new WorkerTarget(agent_host)); |
| 292 break; | 289 break; |
| 293 default: | 290 default: |
| 294 break; | 291 break; |
| 295 } | 292 } |
| 296 } | 293 } |
| 297 | 294 |
| 298 callback.Run(result); | 295 callback.Run(result); |
| 299 } | 296 } |
| OLD | NEW |