Chromium Code Reviews| 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 622e6bb400b2f8e00f4001d15931e61634ab3a38..862bccc8bba4ac7d57f3a0501e9024187f59151d 100644 |
| --- a/chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc |
| +++ b/chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc |
| @@ -12,6 +12,7 @@ |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| +#include "chrome/browser/web_applications/web_app.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| #include "content/public/browser/navigation_entry.h" |
| @@ -30,30 +31,32 @@ const extensions::Extension* GetExtensionForTab(Profile* profile, |
| Browser* browser = chrome::FindBrowserWithWebContents(tab); |
| DCHECK(browser); |
| - GURL url = tab->GetURL(); |
| + // 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()) { |
| - // Only consider the original URL of an app window when determining its |
| - // associated extension. |
| - if (tab->GetController().GetEntryCount()) |
| - url = tab->GetController().GetEntryAtIndex(0)->GetURL(); |
| - |
| - // 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() && |
| - extensions::AppLaunchInfo::GetLaunchWebURL(it->get()) == url) { |
| - return it->get(); |
| - } |
| + return extension_service->GetInstalledExtension( |
| + web_app::GetExtensionIdFromApplicationName(browser->app_name())); |
| + } |
| + |
| + const GURL url = tab->GetURL(); |
| + if (extension_service->IsInstalledApp(url)) |
| + return extension_service->GetInstalledApp(url); |
| + |
| + // 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() && |
| + extensions::AppLaunchInfo::GetLaunchWebURL(it->get()) == url) { |
| + return it->get(); |
| } |
| } |
| } |
| - |
| - return extension_service->GetInstalledApp(url); |
| + return NULL; |
|
Mr4D (OOO till 08-26)
2014/02/07 17:44:03
Same here. A tab might still be an "app".
calamity
2014/02/17 02:03:17
I just moved the app tab stuff up to line 43.
|
| } |
| const extensions::Extension* GetExtensionByID(Profile* profile, |