diff options
author | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 14:41:58 +0000 |
---|---|---|
committer | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 14:41:58 +0000 |
commit | 400c43941943d4bbc4e1f834163728ca989abed8 (patch) | |
tree | 85aa593874a6efca4c34d88bac55834e83319b6d | |
parent | 0fabac5aef4fc6db55c8ad2eeab7d696bdb0d66e (diff) | |
download | chromium_src-400c43941943d4bbc4e1f834163728ca989abed8.zip chromium_src-400c43941943d4bbc4e1f834163728ca989abed8.tar.gz chromium_src-400c43941943d4bbc4e1f834163728ca989abed8.tar.bz2 |
Fix hosted app and extension windows using low resolution taskbar icons.
Hosted app and extension windows currently use the favicon as the
taskbar icon. This means the taskbar icon is scaled from 16x16 to 32x32
which results in an ugly image. This CL makes app windows use the
icon of the extension that URL is associated with.
The retrieved icon size has been changed from 24x24 to 32x32 in
order to avoid bad upscaling in the taskbar and higher resolution icons
will be downscaled if no 32x32 icon is provided.
BUG=94301
Review URL: https://codereview.chromium.org/113293004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240644 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/extension_service.cc | 7 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_service.h | 6 | ||||
-rw-r--r-- | chrome/browser/extensions/tab_helper.cc | 17 |
3 files changed, 22 insertions, 8 deletions
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 19d720f..3da62e6 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -270,8 +270,13 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound( return true; } +const Extension* ExtensionService::GetInstalledExtensionByUrl( + const GURL& url) const { + return extensions_.GetExtensionOrAppByURL(url); +} + const Extension* ExtensionService::GetInstalledApp(const GURL& url) const { - const Extension* extension = extensions_.GetExtensionOrAppByURL(url); + const Extension* extension = GetInstalledExtensionByUrl(url); return (extension && extension->is_app()) ? extension : NULL; } diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index e9e38b6..f6a2f56 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -127,6 +127,12 @@ class ExtensionService public content::NotificationObserver, public extensions::Blacklist::Observer { public: + // Returns the Extension of an extension from a given url or NULL if the url + // doesn't belong to an installed extension. This may be a hosted app extent + // or a chrome-extension:// url. + const extensions::Extension* GetInstalledExtensionByUrl( + const GURL& url) const; + // Returns the Extension of hosted or packaged apps, NULL otherwise. const extensions::Extension* GetInstalledApp(const GURL& url) const; diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc index 2fc6b98..124fef0 100644 --- a/chrome/browser/extensions/tab_helper.cc +++ b/chrome/browser/extensions/tab_helper.cc @@ -55,6 +55,7 @@ #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" +#include "content/public/common/frame_navigate_params.h" #include "extensions/browser/extension_error.h" #include "extensions/common/extension.h" #include "extensions/common/extension_resource.h" @@ -233,15 +234,17 @@ void TabHelper::DidNavigateMainFrame( } #endif // defined(ENABLE_EXTENSIONS) - if (details.is_in_page) - return; - Profile* profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); ExtensionService* service = profile->GetExtensionService(); if (!service) return; + UpdateExtensionAppIcon(service->GetInstalledExtensionByUrl(params.url)); + + if (details.is_in_page) + return; + ExtensionActionManager* extension_action_manager = ExtensionActionManager::Get(profile); for (ExtensionSet::const_iterator it = service->extensions()->begin(); @@ -476,10 +479,10 @@ void TabHelper::UpdateExtensionAppIcon(const Extension* extension) { loader->LoadImageAsync( extension, IconsInfo::GetIconResource(extension, - extension_misc::EXTENSION_ICON_SMALLISH, - ExtensionIconSet::MATCH_EXACTLY), - gfx::Size(extension_misc::EXTENSION_ICON_SMALLISH, - extension_misc::EXTENSION_ICON_SMALLISH), + extension_misc::EXTENSION_ICON_SMALL, + ExtensionIconSet::MATCH_BIGGER), + gfx::Size(extension_misc::EXTENSION_ICON_SMALL, + extension_misc::EXTENSION_ICON_SMALL), base::Bind(&TabHelper::OnImageLoaded, image_loader_ptr_factory_.GetWeakPtr())); } |