Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3537)

Unified Diff: chrome/browser/ui/ash/launcher/launcher_app_tab_helper.cc

Issue 153623002: Make ChromeOS shelf use Browser app name to group hosted app windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add tab extension matching back to AppShortcutLauncherItemController Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
const extensions::Extension* GetExtensionByID(Profile* profile,
« no previous file with comments | « chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698