OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "chrome/browser/extensions/extension_process_manager.h" | 7 #include "chrome/browser/extensions/extension_process_manager.h" |
8 | 8 |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "content/browser/browsing_instance.h" | 10 #include "content/browser/browsing_instance.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 ExtensionHost* ExtensionProcessManager::CreateViewHost( | 140 ExtensionHost* ExtensionProcessManager::CreateViewHost( |
141 const GURL& url, Browser* browser, content::ViewType view_type) { | 141 const GURL& url, Browser* browser, content::ViewType view_type) { |
142 // A NULL browser may only be given for pop-up views. | 142 // A NULL browser may only be given for pop-up views. |
143 DCHECK(browser || | 143 DCHECK(browser || |
144 (!browser && view_type == chrome::VIEW_TYPE_EXTENSION_POPUP)); | 144 (!browser && view_type == chrome::VIEW_TYPE_EXTENSION_POPUP)); |
145 Profile* profile = | 145 Profile* profile = |
146 Profile::FromBrowserContext(browsing_instance_->browser_context()); | 146 Profile::FromBrowserContext(browsing_instance_->browser_context()); |
147 ExtensionService* service = profile->GetExtensionService(); | 147 ExtensionService* service = profile->GetExtensionService(); |
148 if (service) { | 148 if (service) { |
149 const Extension* extension = service->GetExtensionByURL(url); | 149 const Extension* extension = |
| 150 service->extensions()->GetByURL(ExtensionURLInfo(url)); |
150 if (extension) | 151 if (extension) |
151 return CreateViewHost(extension, url, browser, view_type); | 152 return CreateViewHost(extension, url, browser, view_type); |
152 } | 153 } |
153 return NULL; | 154 return NULL; |
154 } | 155 } |
155 | 156 |
156 ExtensionHost* ExtensionProcessManager::CreatePopupHost( | 157 ExtensionHost* ExtensionProcessManager::CreatePopupHost( |
157 const Extension* extension, const GURL& url, Browser* browser) { | 158 const Extension* extension, const GURL& url, Browser* browser) { |
158 return CreateViewHost( | 159 return CreateViewHost( |
159 extension, url, browser, chrome::VIEW_TYPE_EXTENSION_POPUP); | 160 extension, url, browser, chrome::VIEW_TYPE_EXTENSION_POPUP); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 } | 448 } |
448 } | 449 } |
449 | 450 |
450 const Extension* IncognitoExtensionProcessManager::GetExtensionOrAppByURL( | 451 const Extension* IncognitoExtensionProcessManager::GetExtensionOrAppByURL( |
451 const GURL& url) { | 452 const GURL& url) { |
452 Profile* profile = | 453 Profile* profile = |
453 Profile::FromBrowserContext(browsing_instance_->browser_context()); | 454 Profile::FromBrowserContext(browsing_instance_->browser_context()); |
454 ExtensionService* service = profile->GetExtensionService(); | 455 ExtensionService* service = profile->GetExtensionService(); |
455 if (!service) | 456 if (!service) |
456 return NULL; | 457 return NULL; |
457 return (url.SchemeIs(chrome::kExtensionScheme)) ? | 458 return service->extensions()->GetByURL(ExtensionURLInfo(url)); |
458 service->GetExtensionByURL(url) : service->GetExtensionByWebExtent(url); | |
459 } | 459 } |
460 | 460 |
461 bool IncognitoExtensionProcessManager::IsIncognitoEnabled( | 461 bool IncognitoExtensionProcessManager::IsIncognitoEnabled( |
462 const Extension* extension) { | 462 const Extension* extension) { |
463 // Keep in sync with duplicate in extension_info_map.cc. | 463 // Keep in sync with duplicate in extension_info_map.cc. |
464 Profile* profile = | 464 Profile* profile = |
465 Profile::FromBrowserContext(browsing_instance_->browser_context()); | 465 Profile::FromBrowserContext(browsing_instance_->browser_context()); |
466 ExtensionService* service = profile->GetExtensionService(); | 466 ExtensionService* service = profile->GetExtensionService(); |
467 return service && service->IsIncognitoEnabled(extension->id()); | 467 return service && service->IsIncognitoEnabled(extension->id()); |
468 } | 468 } |
(...skipping 21 matching lines...) Expand all Loading... |
490 if (service && service->is_ready()) | 490 if (service && service->is_ready()) |
491 CreateBackgroundHostsForProfileStartup(this, service->extensions()); | 491 CreateBackgroundHostsForProfileStartup(this, service->extensions()); |
492 } | 492 } |
493 break; | 493 break; |
494 } | 494 } |
495 default: | 495 default: |
496 ExtensionProcessManager::Observe(type, source, details); | 496 ExtensionProcessManager::Observe(type, source, details); |
497 break; | 497 break; |
498 } | 498 } |
499 } | 499 } |
OLD | NEW |