diff options
17 files changed, 260 insertions, 200 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 8fd924e..0676b4c 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc @@ -20,6 +20,8 @@ #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" +#include "chrome/browser/extensions/install_tracker.h" +#include "chrome/browser/extensions/install_tracker_factory.h" #include "chrome/browser/extensions/webstore_installer.h" #include "chrome/browser/gpu/gpu_feature_checker.h" #include "chrome/browser/profiles/profile_manager.h" @@ -30,6 +32,7 @@ #include "chrome/browser/ui/app_list/app_list_util.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/extension_l10n_util.h" #include "chrome/common/extensions/extension_manifest_constants.h" @@ -475,17 +478,19 @@ void CompleteInstallFunction::OnGetAppLauncherEnabled( bool app_launcher_enabled) { if (app_launcher_enabled) { std::string name; -#if defined(ENABLE_APP_LIST) if (!approval_->parsed_manifest->GetString(extension_manifest_keys::kName, &name)) { NOTREACHED(); } - // Tell the app list about the install that we just started. - if (is_app_) { - chrome::NotifyAppListOfBeginExtensionInstall( - profile(), id, name, approval_->installing_icon); - } +#if defined(ENABLE_APP_LIST) + // Show the app list so it receives install progress notifications. + chrome::ShowAppList(profile()); #endif + // Tell the app list about the install that we just started. + extensions::InstallTracker* tracker = + extensions::InstallTrackerFactory::GetForProfile(profile()); + tracker->OnBeginExtensionInstall( + id, name, approval_->installing_icon, is_app_); } // The extension will install through the normal extension install flow, but @@ -512,10 +517,9 @@ void CompleteInstallFunction::OnExtensionInstallFailure( const std::string& id, const std::string& error, WebstoreInstaller::FailureReason reason) { -#if defined(ENABLE_APP_LIST) - if (is_app_) - chrome::NotifyAppListOfExtensionInstallFailure(profile(), id); -#endif + extensions::InstallTracker* tracker = + extensions::InstallTrackerFactory::GetForProfile(profile()); + tracker->OnInstallFailure(id); if (test_webstore_installer_delegate) { test_webstore_installer_delegate->OnExtensionInstallFailure( id, error, reason); @@ -531,12 +535,9 @@ void CompleteInstallFunction::OnExtensionInstallFailure( void CompleteInstallFunction::OnExtensionDownloadProgress( const std::string& id, content::DownloadItem* item) { -#if defined(ENABLE_APP_LIST) - if (is_app_) { - chrome::NotifyAppListOfDownloadProgress(profile(), id, - item->PercentComplete()); - } -#endif + extensions::InstallTracker* tracker = + extensions::InstallTrackerFactory::GetForProfile(profile()); + tracker->OnDownloadProgress(id, item->PercentComplete()); } bool GetBrowserLoginFunction::RunImpl() { diff --git a/chrome/browser/extensions/install_observer.h b/chrome/browser/extensions/install_observer.h new file mode 100644 index 0000000..c221be0 --- /dev/null +++ b/chrome/browser/extensions/install_observer.h @@ -0,0 +1,33 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_ +#define CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_ + +namespace gfx { +class ImageSkia; +} + +namespace extensions { + +class InstallObserver { + public: + virtual void OnBeginExtensionInstall( + const std::string& extension_id, + const std::string& extension_name, + const gfx::ImageSkia& installing_icon, + bool is_app) = 0; + + virtual void OnDownloadProgress(const std::string& extension_id, + int percent_downloaded) = 0; + + virtual void OnInstallFailure(const std::string& extension_id) = 0; + + protected: + virtual ~InstallObserver() {} +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_INSTALL_OBSERVER_H_ diff --git a/chrome/browser/extensions/install_tracker.cc b/chrome/browser/extensions/install_tracker.cc new file mode 100644 index 0000000..3d0b984 --- /dev/null +++ b/chrome/browser/extensions/install_tracker.cc @@ -0,0 +1,47 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/install_tracker.h" + +namespace extensions { + +InstallTracker::InstallTracker() { +} + +InstallTracker::~InstallTracker() { +} + +void InstallTracker::AddObserver(InstallObserver* observer) { + observers_.AddObserver(observer); +} + +void InstallTracker::RemoveObserver(InstallObserver* observer) { + observers_.RemoveObserver(observer); +} + +void InstallTracker::OnBeginExtensionInstall( + const std::string& extension_id, + const std::string& extension_name, + const gfx::ImageSkia& installing_icon, + bool is_app) { + FOR_EACH_OBSERVER(InstallObserver, observers_, + OnBeginExtensionInstall(extension_id, + extension_name, + installing_icon, + is_app)); +} + +void InstallTracker::OnDownloadProgress(const std::string& extension_id, + int percent_downloaded) { + FOR_EACH_OBSERVER(InstallObserver, observers_, + OnDownloadProgress(extension_id, percent_downloaded)); +} + +void InstallTracker::OnInstallFailure( + const std::string& extension_id) { + FOR_EACH_OBSERVER(InstallObserver, observers_, + OnInstallFailure(extension_id)); +} + +} // namespace extensions diff --git a/chrome/browser/extensions/install_tracker.h b/chrome/browser/extensions/install_tracker.h new file mode 100644 index 0000000..a15dd53 --- /dev/null +++ b/chrome/browser/extensions/install_tracker.h @@ -0,0 +1,43 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ +#define CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ + +#include "base/observer_list.h" +#include "chrome/browser/extensions/install_observer.h" +#include "chrome/browser/profiles/profile_keyed_service.h" + +namespace gfx { +class ImageSkia; +} + +namespace extensions { + +class InstallTracker : public ProfileKeyedService { + public: + InstallTracker(); + virtual ~InstallTracker(); + + void AddObserver(InstallObserver* observer); + void RemoveObserver(InstallObserver* observer); + + void OnBeginExtensionInstall( + const std::string& extension_id, + const std::string& extension_name, + const gfx::ImageSkia& installing_icon, + bool is_app); + void OnDownloadProgress(const std::string& extension_id, + int percent_downloaded); + void OnInstallFailure(const std::string& extension_id); + + private: + ObserverList<InstallObserver> observers_; + + DISALLOW_COPY_AND_ASSIGN(InstallTracker); +}; + +} // namespace extensions + +#endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_H_ diff --git a/chrome/browser/extensions/install_tracker_factory.cc b/chrome/browser/extensions/install_tracker_factory.cc new file mode 100644 index 0000000..da8c2f4 --- /dev/null +++ b/chrome/browser/extensions/install_tracker_factory.cc @@ -0,0 +1,42 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/extensions/install_tracker_factory.h" + +#include "base/memory/singleton.h" +#include "chrome/browser/extensions/install_tracker.h" +#include "chrome/browser/profiles/profile_dependency_manager.h" + +namespace extensions { + +// static +InstallTracker* InstallTrackerFactory::GetForProfile(Profile* profile) { + return static_cast<InstallTracker*>( + GetInstance()->GetServiceForProfile(profile, true)); +} + +InstallTrackerFactory* InstallTrackerFactory::GetInstance() { + return Singleton<InstallTrackerFactory>::get(); +} + +InstallTrackerFactory::InstallTrackerFactory() + : ProfileKeyedServiceFactory("InstallTracker", + ProfileDependencyManager::GetInstance()) { +} + +InstallTrackerFactory::~InstallTrackerFactory() { +} + +ProfileKeyedService* InstallTrackerFactory::BuildServiceInstanceFor( + Profile* profile) const { + return new InstallTracker(); +} + +bool InstallTrackerFactory::ServiceRedirectedInIncognito() const { + // The installs themselves are routed to the non-incognito profile and so + // should the install progress. + return true; +} + +} // namespace extensions diff --git a/chrome/browser/extensions/install_tracker_factory.h b/chrome/browser/extensions/install_tracker_factory.h new file mode 100644 index 0000000..88e9295 --- /dev/null +++ b/chrome/browser/extensions/install_tracker_factory.h @@ -0,0 +1,40 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_FACTORY_H_ +#define CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_FACTORY_H_ + +#include "chrome/browser/profiles/profile_keyed_service_factory.h" + +template <typename T> struct DefaultSingletonTraits; + +class Profile; + +namespace extensions { + +class InstallTracker; + +class InstallTrackerFactory : public ProfileKeyedServiceFactory { + public: + static InstallTracker* GetForProfile(Profile* profile); + static InstallTrackerFactory* GetInstance(); + + private: + friend struct DefaultSingletonTraits<InstallTrackerFactory>; + + InstallTrackerFactory(); + virtual ~InstallTrackerFactory(); + + // ProfileKeyedServiceFactory overrides: + virtual ProfileKeyedService* BuildServiceInstanceFor( + Profile* profile) const OVERRIDE; + + virtual bool ServiceRedirectedInIncognito() const OVERRIDE; + + DISALLOW_COPY_AND_ASSIGN(InstallTrackerFactory); +}; + +} // namespace extensions; + +#endif // CHROME_BROWSER_EXTENSIONS_INSTALL_TRACKER_FACTORY_H_ diff --git a/chrome/browser/profiles/profile_dependency_manager.cc b/chrome/browser/profiles/profile_dependency_manager.cc index ee59b9a..c49f592 100644 --- a/chrome/browser/profiles/profile_dependency_manager.cc +++ b/chrome/browser/profiles/profile_dependency_manager.cc @@ -45,6 +45,7 @@ #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" #include "chrome/browser/extensions/csp_parser.h" #include "chrome/browser/extensions/extension_system_factory.h" +#include "chrome/browser/extensions/install_tracker_factory.h" #include "chrome/browser/extensions/manifest_url_parser.h" #include "chrome/browser/extensions/web_accessible_resources_parser.h" #include "chrome/browser/favicon/favicon_service_factory.h" @@ -275,6 +276,7 @@ void ProfileDependencyManager::AssertFactoriesBuilt() { extensions::I18nAPI::GetFactoryInstance(); extensions::IdentityAPI::GetFactoryInstance(); extensions::IdleManagerFactory::GetInstance(); + extensions::InstallTrackerFactory::GetInstance(); #if defined(TOOLKIT_VIEWS) extensions::InputAPI::GetFactoryInstance(); #endif diff --git a/chrome/browser/ui/app_list/app_list_util.h b/chrome/browser/ui/app_list/app_list_util.h index 41ac242..f1aa229 100644 --- a/chrome/browser/ui/app_list/app_list_util.h +++ b/chrome/browser/ui/app_list/app_list_util.h @@ -43,22 +43,6 @@ Profile* GetCurrentAppListProfile(); // Returns true if the app list is visible. bool IsAppListVisible(); -// Notify the app list that an extension has started downloading. -void NotifyAppListOfBeginExtensionInstall( - Profile* profile, - const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon); - -void NotifyAppListOfDownloadProgress( - Profile* profile, - const std::string& extension_id, - int percent_downloaded); - -void NotifyAppListOfExtensionInstallFailure( - Profile* profile, - const std::string& extension_id); - } // namespace chrome #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_UTIL_H_ diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc index ab55e07..b4631aa 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc @@ -54,25 +54,6 @@ app_list::SigninDelegate* AppListViewDelegate::GetSigninDelegate() { return signin_delegate_.get(); } -void AppListViewDelegate::OnBeginExtensionInstall( - const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon) { - apps_builder_->OnBeginExtensionInstall(extension_id, - extension_name, - installing_icon); -} - -void AppListViewDelegate::OnDownloadProgress( - const std::string& extension_id, - int percent_downloaded) { - apps_builder_->OnDownloadProgress(extension_id, percent_downloaded); -} - -void AppListViewDelegate::OnInstallFailure(const std::string& extension_id) { - apps_builder_->OnInstallFailure(extension_id); -} - void AppListViewDelegate::ActivateAppListItem( app_list::AppListItemModel* item, int event_flags) { diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.h b/chrome/browser/ui/app_list/app_list_view_delegate.h index 4372ff9..b6a4b9e 100644 --- a/chrome/browser/ui/app_list/app_list_view_delegate.h +++ b/chrome/browser/ui/app_list/app_list_view_delegate.h @@ -31,16 +31,6 @@ class AppListViewDelegate : public app_list::AppListViewDelegate { AppListViewDelegate(AppListControllerDelegate* controller, Profile* profile); virtual ~AppListViewDelegate(); - // Called when an extension with the given id starts being installed. - void OnBeginExtensionInstall(const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon); - - // Called when the download of an extension makes progress. - void OnDownloadProgress(const std::string& extension_id, - int percent_downloaded); - void OnInstallFailure(const std::string& extension_id); - private: // Overridden from app_list::AppListViewDelegate: virtual void SetModel(app_list::AppListModel* model) OVERRIDE; diff --git a/chrome/browser/ui/app_list/apps_model_builder.cc b/chrome/browser/ui/app_list/apps_model_builder.cc index 4bacc0a..904787a 100644 --- a/chrome/browser/ui/app_list/apps_model_builder.cc +++ b/chrome/browser/ui/app_list/apps_model_builder.cc @@ -11,6 +11,8 @@ #include "chrome/browser/extensions/extension_prefs.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_system.h" +#include "chrome/browser/extensions/install_tracker.h" +#include "chrome/browser/extensions/install_tracker_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/extension_app_item.h" #include "chrome/common/chrome_notification_types.h" @@ -43,6 +45,9 @@ AppsModelBuilder::AppsModelBuilder(Profile* profile, controller_(controller), model_(model), ignore_changes_(false) { + extensions::InstallTracker* tracker = + extensions::InstallTrackerFactory::GetForProfile(profile_); + tracker->AddObserver(this); extensions::ExtensionPrefs* extension_prefs = extensions::ExtensionSystem::Get(profile_)->extension_service()-> extension_prefs(); @@ -65,6 +70,9 @@ AppsModelBuilder::AppsModelBuilder(Profile* profile, } AppsModelBuilder::~AppsModelBuilder() { + extensions::InstallTracker* tracker = + extensions::InstallTrackerFactory::GetForProfile(profile_); + tracker->RemoveObserver(this); model_->RemoveObserver(this); } @@ -78,7 +86,10 @@ void AppsModelBuilder::Build() { void AppsModelBuilder::OnBeginExtensionInstall( const std::string& extension_id, const std::string& extension_name, - const gfx::ImageSkia& installing_icon) { + const gfx::ImageSkia& installing_icon, + bool is_app) { + if (!is_app) + return; InsertApp(new ExtensionAppItem(profile_, extension_id, controller_, diff --git a/chrome/browser/ui/app_list/apps_model_builder.h b/chrome/browser/ui/app_list/apps_model_builder.h index 4f06ff30..1a68123 100644 --- a/chrome/browser/ui/app_list/apps_model_builder.h +++ b/chrome/browser/ui/app_list/apps_model_builder.h @@ -10,6 +10,7 @@ #include "base/gtest_prod_util.h" #include "base/prefs/public/pref_change_registrar.h" +#include "chrome/browser/extensions/install_observer.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "ui/app_list/app_list_model.h" @@ -25,7 +26,8 @@ class ImageSkia; } class AppsModelBuilder : public content::NotificationObserver, - public ui::ListModelObserver { + public ui::ListModelObserver, + public extensions::InstallObserver { public: AppsModelBuilder(Profile* profile, app_list::AppListModel::Apps* model, @@ -35,20 +37,19 @@ class AppsModelBuilder : public content::NotificationObserver, // Populates the model. void Build(); - // Called when an extension starts installing. - void OnBeginExtensionInstall(const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon); + private: + typedef std::vector<ExtensionAppItem*> Apps; - // Called when progress is made on an extension's download. - void OnDownloadProgress(const std::string& extension_id, - int percent_downloaded); + // Overridden from extensions::InstallObserver: + virtual void OnBeginExtensionInstall(const std::string& extension_id, + const std::string& extension_name, + const gfx::ImageSkia& installing_icon, + bool is_app) OVERRIDE; - // Called when an extension fails to install. - void OnInstallFailure(const std::string& extension_id); + virtual void OnDownloadProgress(const std::string& extension_id, + int percent_downloaded) OVERRIDE; - private: - typedef std::vector<ExtensionAppItem*> Apps; + virtual void OnInstallFailure(const std::string& extension_id) OVERRIDE; // Adds apps in |extensions| to |apps|. void AddApps(const ExtensionSet* extensions, Apps* apps); diff --git a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc index 73d1abd..ad730c6 100644 --- a/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc +++ b/chrome/browser/ui/ash/app_list/app_list_controller_ash.cc @@ -70,7 +70,8 @@ namespace chrome { // In the win_aura build these are defined in app_list_controller_win.cc. void ShowAppList(Profile* default_profile) { - ash::Shell::GetInstance()->ToggleAppList(NULL); + if (!ash::Shell::GetInstance()->GetAppListTargetVisibility()) + ash::Shell::GetInstance()->ToggleAppList(NULL); } bool IsAppListVisible() { @@ -85,23 +86,5 @@ void DismissAppList() { void SetAppListProfile(const base::FilePath& profile_file_path) { } -void NotifyAppListOfBeginExtensionInstall( - Profile* profile, - const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon) { -} - -void NotifyAppListOfDownloadProgress( - Profile* profile, - const std::string& extension_id, - int percent_downloaded) { -} - -void NotifyAppListOfExtensionInstallFailure( - Profile* profile, - const std::string& extension_id) { -} - } // namespace chrome #endif diff --git a/chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm b/chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm index 85c362d..b798ab9 100644 --- a/chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm +++ b/chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm @@ -139,24 +139,6 @@ void ShowAppList(Profile* profile) { g_app_list_controller.Get().ShowAppList(profile); } -void NotifyAppListOfBeginExtensionInstall( - Profile* profile, - const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon) { -} - -void NotifyAppListOfDownloadProgress( - Profile* profile, - const std::string& extension_id, - int percent_downloaded) { -} - -void NotifyAppListOfExtensionInstallFailure( - Profile* profile, - const std::string& extension_id) { -} - void DismissAppList() { g_app_list_controller.Get().DismissAppList(); } diff --git a/chrome/browser/ui/extensions/extension_install_ui_default.cc b/chrome/browser/ui/extensions/extension_install_ui_default.cc index e8bd56f..b929047 100644 --- a/chrome/browser/ui/extensions/extension_install_ui_default.cc +++ b/chrome/browser/ui/extensions/extension_install_ui_default.cc @@ -175,10 +175,6 @@ void ExtensionInstallUIDefault::OnInstallSuccess(const Extension* extension, Browser* browser = chrome::FindOrCreateTabbedBrowser(current_profile, chrome::GetActiveDesktop()); - if (browser->tab_strip_model()->count() == 0) - chrome::AddBlankTabAt(browser, -1, true); - browser->window()->Show(); - if (extension->is_app()) { bool use_bubble = false; @@ -239,6 +235,10 @@ void ExtensionInstallUI::OpenAppInstalledUI(Browser* browser, content::Source<Profile>(browser->profile()), content::Details<const std::string>(&app_id)); #else + if (browser->tab_strip_model()->count() == 0) + chrome::AddBlankTabAt(browser, -1, true); + browser->window()->Show(); + chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( browser, GURL(chrome::kChromeUINewTabURL))); chrome::Navigate(¶ms); diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc index 9f1aaf8..c9d334d 100644 --- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc +++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc @@ -151,16 +151,7 @@ class AppListController : public ProfileInfoCacheObserver { // Hides the app list. virtual void DismissAppList(); - virtual void OnBeginExtensionInstall(Profile* profile, - const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon); - virtual void OnDownloadProgress(Profile* profile, - const std::string& extension_id, - int percent_downloaded); virtual bool IsAppListVisible() const; - virtual void OnInstallFailure(Profile* profile, - const std::string& extension_id); // Update the profile path stored in local prefs, load it (if not already // loaded), and show the app list. @@ -510,44 +501,10 @@ void AppListController::DismissAppList() { } } -void AppListController::OnBeginExtensionInstall( - Profile* profile, - const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon) { - ShowAppList(profile); - view_delegate_->OnBeginExtensionInstall(extension_id, extension_name, - installing_icon); -} - -void AppListController::OnDownloadProgress(Profile* profile, - const std::string& extension_id, - int percent_downloaded) { - // We only have a model for the current profile, so ignore events about - // others. - // TODO(koz): We should keep a model for each profile so we can record - // information like this. - if (profile != profile_) - return; - view_delegate_->OnDownloadProgress(extension_id, percent_downloaded); -} - bool AppListController::IsAppListVisible() const { return app_list_is_showing_; } -void AppListController::OnInstallFailure(Profile* profile, - const std::string& extension_id) { - // We only have a model for the current profile, so ignore events about - // others. - // TODO(koz): We should keep a model for each profile so we can record - // information like this. - if (profile != profile_) - return; - - view_delegate_->OnInstallFailure(extension_id); -} - void AppListController::AppListClosing() { current_view_ = NULL; view_delegate_ = NULL; @@ -834,25 +791,8 @@ class AppListControllerAsh : public AppListController { virtual void ShowAppList(Profile* profile) OVERRIDE; virtual void DismissAppList() OVERRIDE; - - // The OnBeginExtensionInstall/OnDownloadProgress/OnInstallFalure overrides - // are not necessary for ASH as these are handled by the ash Shell. - virtual void OnBeginExtensionInstall(Profile* profile, - const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon) - OVERRIDE {} - - virtual void OnDownloadProgress(Profile* profile, - const std::string& extension_id, - int percent_downloaded) OVERRIDE {} - virtual bool IsAppListVisible() const OVERRIDE; - virtual void OnInstallFailure( - Profile* profile, - const std::string& extension_id) OVERRIDE {} - private: DISALLOW_COPY_AND_ASSIGN(AppListControllerAsh); }; @@ -941,29 +881,4 @@ bool IsAppListVisible() { return GetCurrentAppListController()->IsAppListVisible(); } -void NotifyAppListOfBeginExtensionInstall( - Profile* profile, - const std::string& extension_id, - const std::string& extension_name, - const gfx::ImageSkia& installing_icon) { - GetCurrentAppListController()->OnBeginExtensionInstall(profile, - extension_id, - extension_name, - installing_icon); -} - -void NotifyAppListOfDownloadProgress( - Profile* profile, - const std::string& extension_id, - int percent_downloaded) { - GetCurrentAppListController()->OnDownloadProgress(profile, extension_id, - percent_downloaded); -} - -void NotifyAppListOfExtensionInstallFailure( - Profile* profile, - const std::string& extension_id) { - GetCurrentAppListController()->OnInstallFailure(profile, extension_id); -} - } // namespace chrome diff --git a/chrome/chrome_browser_extensions.gypi b/chrome/chrome_browser_extensions.gypi index 42ace10..9e7b35c 100644 --- a/chrome/chrome_browser_extensions.gypi +++ b/chrome/chrome_browser_extensions.gypi @@ -637,6 +637,11 @@ 'browser/extensions/image_loader_factory.h', 'browser/extensions/installed_loader.cc', 'browser/extensions/installed_loader.h', + 'browser/extensions/install_observer.h', + 'browser/extensions/install_tracker.cc', + 'browser/extensions/install_tracker.h', + 'browser/extensions/install_tracker_factory.cc', + 'browser/extensions/install_tracker_factory.h', 'browser/extensions/key_identifier_conversion_views.cc', 'browser/extensions/key_identifier_conversion_views.h', 'browser/extensions/lazy_background_task_queue.cc', |