diff options
Diffstat (limited to 'chrome/browser')
8 files changed, 46 insertions, 21 deletions
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc index 2de4971..0144358 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc @@ -485,7 +485,8 @@ void CompleteInstallFunction::OnGetAppLauncherEnabled( extensions::InstallTracker* tracker = extensions::InstallTrackerFactory::GetForProfile(profile()); tracker->OnBeginExtensionInstall( - id, name, approval_->installing_icon, approval_->manifest->is_app()); + id, name, approval_->installing_icon, approval_->manifest->is_app(), + approval_->manifest->is_platform_app()); } // The extension will install through the normal extension install flow, but diff --git a/chrome/browser/extensions/install_observer.h b/chrome/browser/extensions/install_observer.h index d222062..68ffbc4 100644 --- a/chrome/browser/extensions/install_observer.h +++ b/chrome/browser/extensions/install_observer.h @@ -17,7 +17,8 @@ class InstallObserver { const std::string& extension_id, const std::string& extension_name, const gfx::ImageSkia& installing_icon, - bool is_app) = 0; + bool is_app, + bool is_platform_app) = 0; virtual void OnDownloadProgress(const std::string& extension_id, int percent_downloaded) = 0; diff --git a/chrome/browser/extensions/install_tracker.cc b/chrome/browser/extensions/install_tracker.cc index de91234..d92ccf0 100644 --- a/chrome/browser/extensions/install_tracker.cc +++ b/chrome/browser/extensions/install_tracker.cc @@ -24,12 +24,14 @@ void InstallTracker::OnBeginExtensionInstall( const std::string& extension_id, const std::string& extension_name, const gfx::ImageSkia& installing_icon, - bool is_app) { + bool is_app, + bool is_platform_app) { FOR_EACH_OBSERVER(InstallObserver, observers_, OnBeginExtensionInstall(extension_id, extension_name, installing_icon, - is_app)); + is_app, + is_platform_app)); } void InstallTracker::OnDownloadProgress(const std::string& extension_id, diff --git a/chrome/browser/extensions/install_tracker.h b/chrome/browser/extensions/install_tracker.h index fa04213..3caa907 100644 --- a/chrome/browser/extensions/install_tracker.h +++ b/chrome/browser/extensions/install_tracker.h @@ -27,7 +27,8 @@ class InstallTracker : public ProfileKeyedService { const std::string& extension_id, const std::string& extension_name, const gfx::ImageSkia& installing_icon, - bool is_app); + bool is_app, + bool is_platform_app); void OnDownloadProgress(const std::string& extension_id, int percent_downloaded); void OnInstallFailure(const std::string& extension_id); diff --git a/chrome/browser/ui/app_list/apps_model_builder.cc b/chrome/browser/ui/app_list/apps_model_builder.cc index 850d6a1..b8d7ebf 100644 --- a/chrome/browser/ui/app_list/apps_model_builder.cc +++ b/chrome/browser/ui/app_list/apps_model_builder.cc @@ -99,14 +99,16 @@ void AppsModelBuilder::OnBeginExtensionInstall( const std::string& extension_id, const std::string& extension_name, const gfx::ImageSkia& installing_icon, - bool is_app) { + bool is_app, + bool is_platform_app) { if (!is_app) return; InsertApp(new ExtensionAppItem(profile_, extension_id, controller_, extension_name, - installing_icon)); + installing_icon, + is_platform_app)); SetHighlightedApp(extension_id); } @@ -140,7 +142,8 @@ void AppsModelBuilder::AddApps(const ExtensionSet* extensions, Apps* apps) { (*app)->id(), controller_, "", - gfx::ImageSkia())); + gfx::ImageSkia(), + (*app)->is_platform_app())); } } @@ -285,7 +288,8 @@ void AppsModelBuilder::Observe(int type, extension->id(), controller_, "", - gfx::ImageSkia())); + gfx::ImageSkia(), + extension->is_platform_app())); UpdateHighlight(); break; } diff --git a/chrome/browser/ui/app_list/apps_model_builder.h b/chrome/browser/ui/app_list/apps_model_builder.h index 53a1820..424754f 100644 --- a/chrome/browser/ui/app_list/apps_model_builder.h +++ b/chrome/browser/ui/app_list/apps_model_builder.h @@ -48,7 +48,8 @@ class AppsModelBuilder : public content::NotificationObserver, virtual void OnBeginExtensionInstall(const std::string& extension_id, const std::string& extension_name, const gfx::ImageSkia& installing_icon, - bool is_app) OVERRIDE; + bool is_app, + bool is_platform_app) OVERRIDE; virtual void OnDownloadProgress(const std::string& extension_id, int percent_downloaded) OVERRIDE; diff --git a/chrome/browser/ui/app_list/extension_app_item.cc b/chrome/browser/ui/app_list/extension_app_item.cc index d9269ba..246e073 100644 --- a/chrome/browser/ui/app_list/extension_app_item.cc +++ b/chrome/browser/ui/app_list/extension_app_item.cc @@ -185,7 +185,8 @@ ExtensionAppItem::ExtensionAppItem(Profile* profile, const std::string& extension_id, AppListControllerDelegate* controller, const std::string& extension_name, - const gfx::ImageSkia& installing_icon) + const gfx::ImageSkia& installing_icon, + bool is_platform_app) : ChromeAppListItem(TYPE_APP), profile_(profile), extension_id_(extension_id), @@ -193,7 +194,8 @@ ExtensionAppItem::ExtensionAppItem(Profile* profile, extension_name_(extension_name), installing_icon_( gfx::ImageSkiaOperations::CreateHSLShiftedImage(installing_icon, - shift)) { + shift)), + is_platform_app_(is_platform_app) { Reload(); GetExtensionSorting(profile_)->EnsureValidOrdinals(extension_id_, syncer::StringOrdinal()); @@ -206,10 +208,7 @@ bool ExtensionAppItem::HasOverlay() const { #if defined(OS_CHROMEOS) return false; #else - const Extension* extension = GetExtension(); - return extension && - !extension->is_platform_app() && - extension->id() != extension_misc::kChromeAppId; + return !is_platform_app_ && extension_id_ != extension_misc::kChromeAppId; #endif } @@ -277,7 +276,19 @@ void ExtensionAppItem::Move(const ExtensionAppItem* prev, void ExtensionAppItem::UpdateIcon() { if (!GetExtension()) { - SetIcon(installing_icon_, false); + gfx::ImageSkia icon = installing_icon_; + if (HasOverlay()) { + // The tab overlay requires icons of a certain size. + gfx::Size small_size(extension_misc::EXTENSION_ICON_SMALL, + extension_misc::EXTENSION_ICON_SMALL); + icon = gfx::ImageSkiaOperations::CreateResizedImage( + icon, skia::ImageOperations::RESIZE_GOOD, small_size); + + gfx::Size size(extension_misc::EXTENSION_ICON_MEDIUM, + extension_misc::EXTENSION_ICON_MEDIUM); + icon = gfx::ImageSkia(new TabOverlayImageSource(icon, size), size); + } + SetIcon(icon, !HasOverlay()); return; } gfx::ImageSkia icon = icon_->image_skia(); @@ -543,7 +554,7 @@ ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { profile_, this, context_menu_model_.get(), base::Bind(MenuItemHasLauncherContext))); - if (!extension->is_platform_app()) + if (!is_platform_app_) context_menu_model_->AddItem(LAUNCH_NEW, string16()); int index = 0; @@ -564,7 +575,7 @@ ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { IDS_NEW_TAB_APP_CREATE_SHORTCUT); } - if (!extension->is_platform_app()) { + if (!is_platform_app_) { context_menu_model_->AddSeparator(ui::NORMAL_SEPARATOR); context_menu_model_->AddCheckItemWithStringId( LAUNCH_TYPE_REGULAR_TAB, @@ -589,7 +600,7 @@ ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { context_menu_model_->AddItemWithStringId(DETAILS, IDS_NEW_TAB_APP_DETAILS); context_menu_model_->AddItemWithStringId(UNINSTALL, - extension->is_platform_app() ? + is_platform_app_ ? IDS_APP_LIST_UNINSTALL_ITEM : IDS_EXTENSIONS_UNINSTALL); } diff --git a/chrome/browser/ui/app_list/extension_app_item.h b/chrome/browser/ui/app_list/extension_app_item.h index 3dcddff..80769b6 100644 --- a/chrome/browser/ui/app_list/extension_app_item.h +++ b/chrome/browser/ui/app_list/extension_app_item.h @@ -34,7 +34,8 @@ class ExtensionAppItem : public ChromeAppListItem, const std::string& extension_id, AppListControllerDelegate* controller, const std::string& extension_name, - const gfx::ImageSkia& installing_icon); + const gfx::ImageSkia& installing_icon, + bool is_platform_app); virtual ~ExtensionAppItem(); // Reload the title and icon from the underlying extension. @@ -114,6 +115,9 @@ class ExtensionAppItem : public ChromeAppListItem, // Icon for the extension if we can't access the installed extension. gfx::ImageSkia installing_icon_; + // Whether or not this app is a platform app. + bool is_platform_app_; + DISALLOW_COPY_AND_ASSIGN(ExtensionAppItem); }; |