Index: chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc |
diff --git a/chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc b/chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc |
index 862bccc8bba4ac7d57f3a0501e9024187f59151d..9da93cdbf63f0402c38582d09204c73f7691ad5b 100644 |
--- a/chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc |
+++ b/chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc |
@@ -18,36 +18,41 @@ |
#include "content/public/browser/navigation_entry.h" |
#include "content/public/browser/web_contents.h" |
#include "extensions/browser/extension_registry.h" |
+#include "extensions/browser/extension_system.h" |
#include "extensions/common/extension.h" |
+#include "extensions/common/extension_set.h" |
namespace { |
const extensions::Extension* GetExtensionForTab(Profile* profile, |
content::WebContents* tab) { |
- ExtensionService* extension_service = profile->GetExtensionService(); |
- if (!extension_service || !extension_service->extensions_enabled()) |
+ if (!ExtensionSystem::Get(profile)->extension_service()->extensions_enabled()) |
sky
2014/04/04 21:21:13
We seem to have all sorts of code that NULL checks
Devlin
2014/04/04 21:24:14
ExtensionService can be null (in unittests, more t
|
return NULL; |
Browser* browser = chrome::FindBrowserWithWebContents(tab); |
DCHECK(browser); |
+ extensions::ExtensionRegistry* registry = |
+ extensions::ExtensionRegistry::Get(profile); |
+ |
// Use the Browser's app name to determine the extension for app windows and |
// use the tab's url for app tabs. |
if (browser->is_app()) { |
- return extension_service->GetInstalledExtension( |
- web_app::GetExtensionIdFromApplicationName(browser->app_name())); |
+ return registry->GetInstalledExtensionById( |
+ web_app::GetExtensionIdFromApplicationName(browser->app_name()), |
+ extensions::ExtensionRegistry::EVERYTHING); |
} |
const GURL url = tab->GetURL(); |
- if (extension_service->IsInstalledApp(url)) |
- return extension_service->GetInstalledApp(url); |
+ const extensions::ExtensionSet& extensions = registry->enabled_extensions(); |
+ const Extension* extension = extensions.GetAppByURL(url); |
+ if (extension) |
+ return extension; |
// Bookmark app windows should match their launch url extension despite |
// their web extents. |
if (CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableStreamlinedHostedApps)) { |
- const extensions::ExtensionSet& extensions = |
- extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); |
for (extensions::ExtensionSet::const_iterator it = extensions.begin(); |
it != extensions.end(); ++it) { |
if (it->get()->from_bookmark() && |