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

Unified Diff: chrome/browser/extensions/tab_helper.cc

Issue 169443007: Always use the app icon as the taskbar icon for windowed streamlined hosted apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: maintain logic in the non-app-window case 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/tab_helper.cc
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index 638673b6e8fb06e79301d9c1bcfd47e67fec6194..26da0e1c64643908e5774082a72c51c8358be4ea 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/extensions/tab_helper.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -34,6 +35,7 @@
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/web_applications/web_app_ui.h"
#include "chrome/browser/web_applications/web_app.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/extensions/extension_messages.h"
@@ -296,6 +298,9 @@ bool TabHelper::CanCreateApplicationShortcuts() const {
void TabHelper::SetExtensionApp(const Extension* extension) {
DCHECK(!extension || AppLaunchInfo::GetFullLaunchURL(extension).is_valid());
+ if (extension_app_ == extension)
+ return;
+
extension_app_ = extension;
UpdateExtensionAppIcon(extension_app_);
@@ -346,7 +351,20 @@ void TabHelper::DidNavigateMainFrame(
if (!service)
return;
- UpdateExtensionAppIcon(service->GetInstalledExtensionByUrl(params.url));
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableStreamlinedHostedApps)) {
+#if !defined(OS_ANDROID)
+ Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
+ if (browser && browser->is_app()) {
+ SetExtensionApp(service->GetInstalledExtension(
+ web_app::GetExtensionIdFromApplicationName(browser->app_name())));
+ } else {
+ UpdateExtensionAppIcon(service->GetInstalledExtensionByUrl(params.url));
+ }
+#endif
+ } else {
+ UpdateExtensionAppIcon(service->GetInstalledExtensionByUrl(params.url));
+ }
if (details.is_in_page)
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698