summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorhenrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 11:58:09 +0000
committerhenrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-26 11:58:09 +0000
commit7256ed819457ed2196373f3441f5b5494779a6fd (patch)
tree730347521dc7ddb473ac6d08c7aed1ed9501fa92 /chrome/browser
parentd0b262357d1a64abd8b20721d484d7d778a4aceb (diff)
downloadchromium_src-7256ed819457ed2196373f3441f5b5494779a6fd.zip
chromium_src-7256ed819457ed2196373f3441f5b5494779a6fd.tar.gz
chromium_src-7256ed819457ed2196373f3441f5b5494779a6fd.tar.bz2
Revert 184604
> Change NotifyAppList*() functions into observers on a ProfileKeyedService. > > This causes the events to also be delivered to the app list on ChromeOS, which would otherwise require separate plumbing. > > > BUG=152854 > > > Review URL: https://chromiumcodereview.appspot.com/12298015 TBR=koz@chromium.org Review URL: https://codereview.chromium.org/12340071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/api/webstore_private/webstore_private_api.cc33
-rw-r--r--chrome/browser/extensions/install_observer.h33
-rw-r--r--chrome/browser/extensions/install_tracker.cc47
-rw-r--r--chrome/browser/extensions/install_tracker.h43
-rw-r--r--chrome/browser/extensions/install_tracker_factory.cc42
-rw-r--r--chrome/browser/extensions/install_tracker_factory.h40
-rw-r--r--chrome/browser/profiles/profile_dependency_manager.cc2
-rw-r--r--chrome/browser/ui/app_list/app_list_util.h16
-rw-r--r--chrome/browser/ui/app_list/app_list_view_delegate.cc19
-rw-r--r--chrome/browser/ui/app_list/app_list_view_delegate.h10
-rw-r--r--chrome/browser/ui/app_list/apps_model_builder.cc13
-rw-r--r--chrome/browser/ui/app_list/apps_model_builder.h25
-rw-r--r--chrome/browser/ui/ash/app_list/app_list_controller_ash.cc21
-rw-r--r--chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm18
-rw-r--r--chrome/browser/ui/extensions/extension_install_ui_default.cc8
-rw-r--r--chrome/browser/ui/views/app_list/app_list_controller_win.cc85
16 files changed, 200 insertions, 255 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 0676b4c..8fd924e 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -20,8 +20,6 @@
#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"
@@ -32,7 +30,6 @@
#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"
@@ -478,19 +475,17 @@ 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();
}
-#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_);
+ if (is_app_) {
+ chrome::NotifyAppListOfBeginExtensionInstall(
+ profile(), id, name, approval_->installing_icon);
+ }
+#endif
}
// The extension will install through the normal extension install flow, but
@@ -517,9 +512,10 @@ void CompleteInstallFunction::OnExtensionInstallFailure(
const std::string& id,
const std::string& error,
WebstoreInstaller::FailureReason reason) {
- extensions::InstallTracker* tracker =
- extensions::InstallTrackerFactory::GetForProfile(profile());
- tracker->OnInstallFailure(id);
+#if defined(ENABLE_APP_LIST)
+ if (is_app_)
+ chrome::NotifyAppListOfExtensionInstallFailure(profile(), id);
+#endif
if (test_webstore_installer_delegate) {
test_webstore_installer_delegate->OnExtensionInstallFailure(
id, error, reason);
@@ -535,9 +531,12 @@ void CompleteInstallFunction::OnExtensionInstallFailure(
void CompleteInstallFunction::OnExtensionDownloadProgress(
const std::string& id,
content::DownloadItem* item) {
- extensions::InstallTracker* tracker =
- extensions::InstallTrackerFactory::GetForProfile(profile());
- tracker->OnDownloadProgress(id, item->PercentComplete());
+#if defined(ENABLE_APP_LIST)
+ if (is_app_) {
+ chrome::NotifyAppListOfDownloadProgress(profile(), id,
+ item->PercentComplete());
+ }
+#endif
}
bool GetBrowserLoginFunction::RunImpl() {
diff --git a/chrome/browser/extensions/install_observer.h b/chrome/browser/extensions/install_observer.h
deleted file mode 100644
index c221be0..0000000
--- a/chrome/browser/extensions/install_observer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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
deleted file mode 100644
index 3d0b984..0000000
--- a/chrome/browser/extensions/install_tracker.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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
deleted file mode 100644
index a15dd53..0000000
--- a/chrome/browser/extensions/install_tracker.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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
deleted file mode 100644
index da8c2f4..0000000
--- a/chrome/browser/extensions/install_tracker_factory.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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
deleted file mode 100644
index 88e9295..0000000
--- a/chrome/browser/extensions/install_tracker_factory.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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 c49f592..ee59b9a 100644
--- a/chrome/browser/profiles/profile_dependency_manager.cc
+++ b/chrome/browser/profiles/profile_dependency_manager.cc
@@ -45,7 +45,6 @@
#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"
@@ -276,7 +275,6 @@ 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 f1aa229..41ac242 100644
--- a/chrome/browser/ui/app_list/app_list_util.h
+++ b/chrome/browser/ui/app_list/app_list_util.h
@@ -43,6 +43,22 @@ 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 b4631aa..ab55e07 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
@@ -54,6 +54,25 @@ 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 b6a4b9e..4372ff9 100644
--- a/chrome/browser/ui/app_list/app_list_view_delegate.h
+++ b/chrome/browser/ui/app_list/app_list_view_delegate.h
@@ -31,6 +31,16 @@ 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 904787a..4bacc0a 100644
--- a/chrome/browser/ui/app_list/apps_model_builder.cc
+++ b/chrome/browser/ui/app_list/apps_model_builder.cc
@@ -11,8 +11,6 @@
#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"
@@ -45,9 +43,6 @@ 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();
@@ -70,9 +65,6 @@ AppsModelBuilder::AppsModelBuilder(Profile* profile,
}
AppsModelBuilder::~AppsModelBuilder() {
- extensions::InstallTracker* tracker =
- extensions::InstallTrackerFactory::GetForProfile(profile_);
- tracker->RemoveObserver(this);
model_->RemoveObserver(this);
}
@@ -86,10 +78,7 @@ void AppsModelBuilder::Build() {
void AppsModelBuilder::OnBeginExtensionInstall(
const std::string& extension_id,
const std::string& extension_name,
- const gfx::ImageSkia& installing_icon,
- bool is_app) {
- if (!is_app)
- return;
+ const gfx::ImageSkia& installing_icon) {
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 1a68123..4f06ff30 100644
--- a/chrome/browser/ui/app_list/apps_model_builder.h
+++ b/chrome/browser/ui/app_list/apps_model_builder.h
@@ -10,7 +10,6 @@
#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"
@@ -26,8 +25,7 @@ class ImageSkia;
}
class AppsModelBuilder : public content::NotificationObserver,
- public ui::ListModelObserver,
- public extensions::InstallObserver {
+ public ui::ListModelObserver {
public:
AppsModelBuilder(Profile* profile,
app_list::AppListModel::Apps* model,
@@ -37,19 +35,20 @@ class AppsModelBuilder : public content::NotificationObserver,
// Populates the model.
void Build();
- private:
- typedef std::vector<ExtensionAppItem*> Apps;
+ // Called when an extension starts installing.
+ void OnBeginExtensionInstall(const std::string& extension_id,
+ const std::string& extension_name,
+ const gfx::ImageSkia& installing_icon);
- // 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 progress is made on an extension's download.
+ void OnDownloadProgress(const std::string& extension_id,
+ int percent_downloaded);
- virtual void OnDownloadProgress(const std::string& extension_id,
- int percent_downloaded) OVERRIDE;
+ // Called when an extension fails to install.
+ void OnInstallFailure(const std::string& extension_id);
- virtual void OnInstallFailure(const std::string& extension_id) OVERRIDE;
+ private:
+ typedef std::vector<ExtensionAppItem*> Apps;
// 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 ad730c6..73d1abd 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,8 +70,7 @@ namespace chrome {
// In the win_aura build these are defined in app_list_controller_win.cc.
void ShowAppList(Profile* default_profile) {
- if (!ash::Shell::GetInstance()->GetAppListTargetVisibility())
- ash::Shell::GetInstance()->ToggleAppList(NULL);
+ ash::Shell::GetInstance()->ToggleAppList(NULL);
}
bool IsAppListVisible() {
@@ -86,5 +85,23 @@ 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 b798ab9..85c362d 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,6 +139,24 @@ 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 b929047..e8bd56f 100644
--- a/chrome/browser/ui/extensions/extension_install_ui_default.cc
+++ b/chrome/browser/ui/extensions/extension_install_ui_default.cc
@@ -175,6 +175,10 @@ 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;
@@ -235,10 +239,6 @@ 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(&params);
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 c9d334d..9f1aaf8 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,7 +151,16 @@ 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.
@@ -501,10 +510,44 @@ 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;
@@ -791,8 +834,25 @@ 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);
};
@@ -881,4 +941,29 @@ 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