summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrpaquay@chromium.org <rpaquay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-20 21:46:34 +0000
committerrpaquay@chromium.org <rpaquay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-20 21:46:34 +0000
commite43c61fee54b31686cd10ce4f6d89059703db43e (patch)
tree077e27b37d55b9af6282dcc3f249c3a0703e3eaf
parent9b74685b3e1cce1ef5dd5a825db0a1cfaf3828c5 (diff)
downloadchromium_src-e43c61fee54b31686cd10ce4f6d89059703db43e.zip
chromium_src-e43c61fee54b31686cd10ce4f6d89059703db43e.tar.gz
chromium_src-e43c61fee54b31686cd10ce4f6d89059703db43e.tar.bz2
Add "UninstallReason" parameter to ExtensionRegistryObserver::OnExtensionUninstalled.
BUG=84556 TBR=sky@chromium.org Review URL: https://codereview.chromium.org/398083002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284381 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/apps/drive/drive_app_provider.cc11
-rw-r--r--chrome/browser/apps/drive/drive_app_provider.h3
-rw-r--r--chrome/browser/apps/ephemeral_app_browsertest.cc5
-rw-r--r--chrome/browser/apps/ephemeral_app_service.cc10
-rw-r--r--chrome/browser/apps/ephemeral_app_service.h3
-rw-r--r--chrome/browser/apps/shortcut_manager.cc3
-rw-r--r--chrome/browser/apps/shortcut_manager.h3
-rw-r--r--chrome/browser/background/background_application_list_model_unittest.cc23
-rw-r--r--chrome/browser/extensions/activity_log/activity_log.cc3
-rw-r--r--chrome/browser/extensions/activity_log/activity_log.h6
-rw-r--r--chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc5
-rw-r--r--chrome/browser/extensions/activity_log/activity_log_unittest.cc4
-rw-r--r--chrome/browser/extensions/api/alarms/alarm_manager.cc3
-rw-r--r--chrome/browser/extensions/api/alarms/alarm_manager.h6
-rw-r--r--chrome/browser/extensions/api/commands/command_service.cc3
-rw-r--r--chrome/browser/extensions/api/commands/command_service.h6
-rw-r--r--chrome/browser/extensions/api/declarative/rules_registry_service.cc3
-rw-r--r--chrome/browser/extensions/api/declarative/rules_registry_service.h6
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.cc3
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api.h6
-rw-r--r--chrome/browser/extensions/api/management/management_api.cc8
-rw-r--r--chrome/browser/extensions/api/management/management_api.h6
-rw-r--r--chrome/browser/extensions/api/storage/managed_value_store_cache.cc9
-rw-r--r--chrome/browser/extensions/error_console/error_console.cc3
-rw-r--r--chrome/browser/extensions/error_console/error_console.h6
-rw-r--r--chrome/browser/extensions/extension_browsertest.cc3
-rw-r--r--chrome/browser/extensions/extension_context_menu_model.cc6
-rw-r--r--chrome/browser/extensions/extension_disabled_ui.cc5
-rw-r--r--chrome/browser/extensions/extension_gcm_app_handler.cc3
-rw-r--r--chrome/browser/extensions/extension_gcm_app_handler.h6
-rw-r--r--chrome/browser/extensions/extension_gcm_app_handler_unittest.cc3
-rw-r--r--chrome/browser/extensions/extension_message_bubble_controller_unittest.cc19
-rw-r--r--chrome/browser/extensions/extension_service.cc20
-rw-r--r--chrome/browser/extensions/extension_service.h22
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc23
-rw-r--r--chrome/browser/extensions/extension_storage_monitor.cc6
-rw-r--r--chrome/browser/extensions/extension_storage_monitor.h6
-rw-r--r--chrome/browser/extensions/extension_sync_service.cc3
-rw-r--r--chrome/browser/extensions/extension_toolbar_model.cc3
-rw-r--r--chrome/browser/extensions/extension_toolbar_model.h6
-rw-r--r--chrome/browser/extensions/external_install_error.cc8
-rw-r--r--chrome/browser/extensions/external_install_manager.cc3
-rw-r--r--chrome/browser/extensions/external_install_manager.h6
-rw-r--r--chrome/browser/extensions/shared_module_service.cc6
-rw-r--r--chrome/browser/extensions/shared_module_service.h6
-rw-r--r--chrome/browser/extensions/shared_module_service_unittest.cc5
-rw-r--r--chrome/browser/policy/policy_browsertest.cc3
-rw-r--r--chrome/browser/search/hotword_service.cc6
-rw-r--r--chrome/browser/search/hotword_service.h3
-rw-r--r--chrome/browser/sync/test/integration/extensions_helper.cc6
-rw-r--r--chrome/browser/sync/test/integration/sync_extension_helper.cc3
-rw-r--r--chrome/browser/sync_file_system/sync_file_system_service.cc3
-rw-r--r--chrome/browser/sync_file_system/sync_file_system_service.h3
-rw-r--r--chrome/browser/themes/theme_service.cc5
-rw-r--r--chrome/browser/themes/theme_service_unittest.cc3
-rw-r--r--chrome/browser/ui/app_list/app_list_syncable_service.cc4
-rw-r--r--chrome/browser/ui/app_list/extension_app_model_builder.cc3
-rw-r--r--chrome/browser/ui/app_list/extension_app_model_builder.h3
-rw-r--r--chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc5
-rw-r--r--chrome/browser/ui/app_list/extension_uninstaller.cc3
-rw-r--r--chrome/browser/ui/app_list/recommended_apps.cc3
-rw-r--r--chrome/browser/ui/app_list/recommended_apps.h3
-rw-r--r--chrome/browser/ui/app_list/search/app_result.cc3
-rw-r--r--chrome/browser/ui/app_list/search/app_result.h3
-rw-r--r--chrome/browser/ui/app_list/search/app_search_provider.cc3
-rw-r--r--chrome/browser/ui/app_list/search/app_search_provider.h3
-rw-r--r--chrome/browser/ui/app_list/search/app_search_provider_unittest.cc3
-rw-r--r--chrome/browser/ui/browser_browsertest.cc6
-rw-r--r--chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm3
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm3
-rw-r--r--chrome/browser/ui/extensions/extension_enable_flow.cc3
-rw-r--r--chrome/browser/ui/extensions/extension_enable_flow.h3
-rw-r--r--chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.cc3
-rw-r--r--chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc5
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.cc6
-rw-r--r--chrome/browser/ui/webui/extensions/extension_settings_handler.h6
-rw-r--r--chrome/browser/ui/webui/ntp/app_launcher_handler.cc3
-rw-r--r--extensions/browser/extension_registry.cc10
-rw-r--r--extensions/browser/extension_registry.h3
-rw-r--r--extensions/browser/extension_registry_observer.h4
-rw-r--r--extensions/browser/extension_registry_unittest.cc11
-rw-r--r--extensions/browser/state_store.cc3
-rw-r--r--extensions/browser/state_store.h6
-rw-r--r--extensions/browser/test_extension_registry_observer.cc3
-rw-r--r--extensions/browser/test_extension_registry_observer.h6
-rw-r--r--extensions/browser/uninstall_reason.h29
-rw-r--r--extensions/extensions.gyp1
87 files changed, 311 insertions, 195 deletions
diff --git a/chrome/browser/apps/drive/drive_app_provider.cc b/chrome/browser/apps/drive/drive_app_provider.cc
index 7952764..46ac570 100644
--- a/chrome/browser/apps/drive/drive_app_provider.cc
+++ b/chrome/browser/apps/drive/drive_app_provider.cc
@@ -21,6 +21,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_factory.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
using extensions::Extension;
@@ -82,9 +83,8 @@ void DriveAppProvider::UpdateMappingAndExtensionSystem(
if (existing_app && is_existing_app_generated) {
extensions::ExtensionSystem::Get(profile_)
->extension_service()
- ->UninstallExtension(existing_chrome_app_id,
- ExtensionService::UNINSTALL_REASON_SYNC,
- NULL);
+ ->UninstallExtension(
+ existing_chrome_app_id, extensions::UNINSTALL_REASON_SYNC, NULL);
}
}
@@ -194,7 +194,7 @@ void DriveAppProvider::ProcessRemovedDriveApp(const std::string& drive_app_id) {
extensions::ExtensionSystem::Get(profile_)
->extension_service()
->UninstallExtension(
- chrome_app_id, ExtensionService::UNINSTALL_REASON_SYNC, NULL);
+ chrome_app_id, extensions::UNINSTALL_REASON_SYNC, NULL);
}
void DriveAppProvider::OnDriveAppRegistryUpdated() {
@@ -257,7 +257,8 @@ void DriveAppProvider::OnExtensionInstalled(
void DriveAppProvider::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
std::string drive_app_id = mapping_->GetDriveApp(extension->id());
if (drive_app_id.empty())
return;
diff --git a/chrome/browser/apps/drive/drive_app_provider.h b/chrome/browser/apps/drive/drive_app_provider.h
index b6fe1823c..69fdc30 100644
--- a/chrome/browser/apps/drive/drive_app_provider.h
+++ b/chrome/browser/apps/drive/drive_app_provider.h
@@ -78,7 +78,8 @@ class DriveAppProvider : public drive::DriveAppRegistryObserver,
bool is_update) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
Profile* profile_;
diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc
index 213c7c96..0a24044 100644
--- a/chrome/browser/apps/ephemeral_app_browsertest.cc
+++ b/chrome/browser/apps/ephemeral_app_browsertest.cc
@@ -31,6 +31,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/process_manager.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/switches.h"
#include "sync/api/fake_sync_change_processor.h"
@@ -244,9 +245,7 @@ void EphemeralAppTestBase::EvictApp(const std::string& app_id) {
ExtensionSystem::Get(profile())->extension_service();
ASSERT_TRUE(service);
service->UninstallExtension(
- app_id,
- ExtensionService::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
- NULL);
+ app_id, extensions::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION, NULL);
uninstalled_signal.Wait();
}
diff --git a/chrome/browser/apps/ephemeral_app_service.cc b/chrome/browser/apps/ephemeral_app_service.cc
index de05309..0fbc007 100644
--- a/chrome/browser/apps/ephemeral_app_service.cc
+++ b/chrome/browser/apps/ephemeral_app_service.cc
@@ -18,6 +18,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
@@ -101,7 +102,7 @@ void EphemeralAppService::ClearCachedApps() {
ExtensionRegistry::EVERYTHING));
service->UninstallExtension(
extension_id,
- ExtensionService::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
+ extensions::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
NULL);
}
}
@@ -147,7 +148,8 @@ void EphemeralAppService::OnExtensionWillBeInstalled(
void EphemeralAppService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) {
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) {
if (extensions::util::IsEphemeralApp(extension->id(), profile_)) {
--ephemeral_app_count_;
DCHECK_GE(ephemeral_app_count_, 0);
@@ -236,9 +238,7 @@ void EphemeralAppService::GarbageCollectApps() {
continue;
service->UninstallExtension(
- *id,
- ExtensionService::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
- NULL);
+ *id, extensions::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION, NULL);
}
}
}
diff --git a/chrome/browser/apps/ephemeral_app_service.h b/chrome/browser/apps/ephemeral_app_service.h
index 367c554..ede710a 100644
--- a/chrome/browser/apps/ephemeral_app_service.h
+++ b/chrome/browser/apps/ephemeral_app_service.h
@@ -67,7 +67,8 @@ class EphemeralAppService : public KeyedService,
const std::string& old_name) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
void Init();
void InitEphemeralAppCount();
diff --git a/chrome/browser/apps/shortcut_manager.cc b/chrome/browser/apps/shortcut_manager.cc
index 552fb34..d2a010e 100644
--- a/chrome/browser/apps/shortcut_manager.cc
+++ b/chrome/browser/apps/shortcut_manager.cc
@@ -138,7 +138,8 @@ void AppShortcutManager::OnExtensionWillBeInstalled(
void AppShortcutManager::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
web_app::DeleteAllShortcuts(profile_, extension);
}
diff --git a/chrome/browser/apps/shortcut_manager.h b/chrome/browser/apps/shortcut_manager.h
index f47a90f..c13c921 100644
--- a/chrome/browser/apps/shortcut_manager.h
+++ b/chrome/browser/apps/shortcut_manager.h
@@ -47,7 +47,8 @@ class AppShortcutManager : public KeyedService,
const std::string& old_name) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// ProfileInfoCacheObserver.
virtual void OnProfileWillBeRemoved(
diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc
index 81da6eb..cb024d5 100644
--- a/chrome/browser/background/background_application_list_model_unittest.cc
+++ b/chrome/browser/background/background_application_list_model_unittest.cc
@@ -21,6 +21,7 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_types.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/permissions/api_permission.h"
@@ -212,27 +213,27 @@ TEST_F(BackgroundApplicationListModelTest, MAYBE_ExplicitTest) {
// Remove in FIFO order.
ASSERT_FALSE(IsBackgroundApp(*ext1.get()));
service->UninstallExtension(
- ext1->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ ext1->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(4U, service->extensions()->size());
ASSERT_EQ(2U, model->size());
ASSERT_TRUE(IsBackgroundApp(*bgapp1.get()));
service->UninstallExtension(
- bgapp1->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ bgapp1->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(3U, service->extensions()->size());
ASSERT_EQ(1U, model->size());
ASSERT_FALSE(IsBackgroundApp(*ext2.get()));
service->UninstallExtension(
- ext2->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ ext2->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(2U, service->extensions()->size());
ASSERT_EQ(1U, model->size());
ASSERT_TRUE(IsBackgroundApp(*bgapp2.get()));
service->UninstallExtension(
- bgapp2->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ bgapp2->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(1U, service->extensions()->size());
ASSERT_EQ(0U, model->size());
ASSERT_FALSE(IsBackgroundApp(*ext3.get()));
service->UninstallExtension(
- ext3->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ ext3->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(0U, service->extensions()->size());
ASSERT_EQ(0U, model->size());
}
@@ -284,7 +285,7 @@ TEST_F(BackgroundApplicationListModelTest, PushMessagingTest) {
// Need to remove ext2 because it uses same id as bgapp3.
ASSERT_FALSE(IsBackgroundApp(*ext2.get()));
service->UninstallExtension(
- ext2->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ ext2->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(3U, service->extensions()->size());
ASSERT_EQ(2U, model->size());
ASSERT_TRUE(IsBackgroundApp(*bgapp3.get()));
@@ -295,22 +296,22 @@ TEST_F(BackgroundApplicationListModelTest, PushMessagingTest) {
// Remove in FIFO order.
ASSERT_FALSE(IsBackgroundApp(*ext1.get()));
service->UninstallExtension(
- ext1->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ ext1->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(3U, service->extensions()->size());
ASSERT_EQ(3U, model->size());
ASSERT_TRUE(IsBackgroundApp(*bgapp1.get()));
service->UninstallExtension(
- bgapp1->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ bgapp1->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(2U, service->extensions()->size());
ASSERT_EQ(2U, model->size());
ASSERT_TRUE(IsBackgroundApp(*bgapp2.get()));
service->UninstallExtension(
- bgapp2->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ bgapp2->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(1U, service->extensions()->size());
ASSERT_EQ(1U, model->size());
ASSERT_TRUE(IsBackgroundApp(*bgapp3.get()));
service->UninstallExtension(
- bgapp3->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ bgapp3->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(0U, service->extensions()->size());
ASSERT_EQ(0U, model->size());
}
@@ -428,7 +429,7 @@ void RemoveExtension(ExtensionService* service,
--*count;
ASSERT_EQ(*count, extensions->size());
service->UninstallExtension(
- extension->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ extension->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
ASSERT_EQ(*count, service->extensions()->size());
ASSERT_EQ(*expected, model->size());
}
diff --git a/chrome/browser/extensions/activity_log/activity_log.cc b/chrome/browser/extensions/activity_log/activity_log.cc
index 17436ce..ec44065 100644
--- a/chrome/browser/extensions/activity_log/activity_log.cc
+++ b/chrome/browser/extensions/activity_log/activity_log.cc
@@ -502,7 +502,8 @@ void ActivityLog::OnExtensionUnloaded(content::BrowserContext* browser_context,
// OnExtensionUnloaded will also be called right before this.
void ActivityLog::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
if (ActivityLogAPI::IsExtensionWhitelisted(extension->id()) &&
!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableExtensionActivityLogging) &&
diff --git a/chrome/browser/extensions/activity_log/activity_log.h b/chrome/browser/extensions/activity_log/activity_log.h
index 28680f8..74b5472 100644
--- a/chrome/browser/extensions/activity_log/activity_log.h
+++ b/chrome/browser/extensions/activity_log/activity_log.h
@@ -96,8 +96,10 @@ class ActivityLog : public BrowserContextKeyedAPI,
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// ApiActivityMonitor.
virtual void OnApiEventDispatched(
diff --git a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc
index b5ad5d0..eafd806 100644
--- a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc
@@ -13,6 +13,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension_builder.h"
#if defined OS_CHROMEOS
@@ -189,7 +190,7 @@ TEST_F(ActivityLogEnabledTest, WatchdogSwitch) {
EXPECT_FALSE(activity_log2->IsDatabaseEnabled());
extension_service1->UninstallExtension(
- kExtensionID, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kExtensionID, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
EXPECT_EQ(0,
profile1->GetPrefs()->GetInteger(prefs::kWatchdogExtensionActive));
@@ -265,7 +266,7 @@ TEST_F(ActivityLogEnabledTest, AppAndCommandLine) {
EXPECT_TRUE(activity_log->IsWatchdogAppActive());
extension_service->UninstallExtension(
- kExtensionID, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kExtensionID, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
EXPECT_TRUE(activity_log->IsDatabaseEnabled());
EXPECT_EQ(0,
diff --git a/chrome/browser/extensions/activity_log/activity_log_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_unittest.cc
index ed7fd0b..b187343 100644
--- a/chrome/browser/extensions/activity_log/activity_log_unittest.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_unittest.cc
@@ -20,6 +20,7 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/extension_registry.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/dom_action_types.h"
#include "extensions/common/extension_builder.h"
#include "sql/statement.h"
@@ -368,7 +369,8 @@ TEST_F(ActivityLogTest, UninstalledExtension) {
"document.write");
action->set_page_url(GURL("http://www.google.com"));
- activity_log->OnExtensionUninstalled(NULL, extension);
+ activity_log->OnExtensionUninstalled(
+ NULL, extension, extensions::UNINSTALL_REASON_FOR_TESTING);
activity_log->GetFilteredActions(
extension->id(),
Action::ACTION_ANY,
diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.cc b/chrome/browser/extensions/api/alarms/alarm_manager.cc
index 024e3cb..8274800 100644
--- a/chrome/browser/extensions/api/alarms/alarm_manager.cc
+++ b/chrome/browser/extensions/api/alarms/alarm_manager.cc
@@ -419,7 +419,8 @@ void AlarmManager::OnExtensionLoaded(content::BrowserContext* browser_context,
void AlarmManager::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
RemoveAllAlarms(extension->id(), base::Bind(RemoveAllOnUninstallCallback));
}
diff --git a/chrome/browser/extensions/api/alarms/alarm_manager.h b/chrome/browser/extensions/api/alarms/alarm_manager.h
index 9a44370..6912ee2 100644
--- a/chrome/browser/extensions/api/alarms/alarm_manager.h
+++ b/chrome/browser/extensions/api/alarms/alarm_manager.h
@@ -204,8 +204,10 @@ class AlarmManager : public BrowserContextKeyedAPI,
// ExtensionRegistryObserver implementation.
virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
const Extension* extension) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// BrowserContextKeyedAPI implementation.
static const char* service_name() {
diff --git a/chrome/browser/extensions/api/commands/command_service.cc b/chrome/browser/extensions/api/commands/command_service.cc
index 3656f4b..ddcf18e 100644
--- a/chrome/browser/extensions/api/commands/command_service.cc
+++ b/chrome/browser/extensions/api/commands/command_service.cc
@@ -305,7 +305,8 @@ void CommandService::OnExtensionWillBeInstalled(
void CommandService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
RemoveKeybindingPrefs(extension->id(), std::string());
}
diff --git a/chrome/browser/extensions/api/commands/command_service.h b/chrome/browser/extensions/api/commands/command_service.h
index 088896d..1304f9a 100644
--- a/chrome/browser/extensions/api/commands/command_service.h
+++ b/chrome/browser/extensions/api/commands/command_service.h
@@ -185,8 +185,10 @@ class CommandService : public BrowserContextKeyedAPI,
bool is_update,
bool from_ephemeral,
const std::string& old_name) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// Updates keybindings for a given |extension|'s page action, browser action
// and named commands. Assigns new keybindings and removes relinquished
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.cc b/chrome/browser/extensions/api/declarative/rules_registry_service.cc
index 7f3d12f..5da12ef 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.cc
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.cc
@@ -213,7 +213,8 @@ void RulesRegistryService::OnExtensionUnloaded(
void RulesRegistryService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
NotifyRegistriesHelper(&RulesRegistry::OnExtensionUninstalled,
extension->id());
}
diff --git a/chrome/browser/extensions/api/declarative/rules_registry_service.h b/chrome/browser/extensions/api/declarative/rules_registry_service.h
index 37bb8c0..8ea722c 100644
--- a/chrome/browser/extensions/api/declarative/rules_registry_service.h
+++ b/chrome/browser/extensions/api/declarative/rules_registry_service.h
@@ -116,8 +116,10 @@ class RulesRegistryService : public BrowserContextKeyedAPI,
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// Iterates over all registries, and calls |notification_callback| on them
// with |extension_id| as the argument. If a registry lives on a different
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
index a3b86c1..3229315 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -280,7 +280,8 @@ void DeveloperPrivateEventRouter::OnExtensionWillBeInstalled(
void DeveloperPrivateEventRouter::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
DCHECK(profile_->IsSameProfile(Profile::FromBrowserContext(browser_context)));
BroadcastItemStateChanged(
browser_context, developer::EVENT_TYPE_UNINSTALLED, extension->id());
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h
index 1697bd1..6525bd4 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api.h
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h
@@ -88,8 +88,10 @@ class DeveloperPrivateEventRouter : public content::NotificationObserver,
bool is_update,
bool from_ephemeral,
const std::string& old_name) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// ErrorConsole::Observer implementation.
virtual void OnErrorAdded(const ExtensionError* error) OVERRIDE;
diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc
index c884933..98a4899 100644
--- a/chrome/browser/extensions/api/management/management_api.cc
+++ b/chrome/browser/extensions/api/management/management_api.cc
@@ -44,6 +44,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/management_policy.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
@@ -647,9 +648,7 @@ void ManagementUninstallFunctionBase::Finish(bool should_uninstall) {
SendResponse(false);
} else {
bool success = service()->UninstallExtension(
- extension_id_,
- ExtensionService::UNINSTALL_REASON_MANAGEMENT_API,
- NULL);
+ extension_id_, extensions::UNINSTALL_REASON_MANAGEMENT_API, NULL);
// TODO set error_ if !success
SendResponse(success);
@@ -954,7 +953,8 @@ void ManagementEventRouter::OnExtensionInstalled(
void ManagementEventRouter::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
BroadcastEvent(extension, management::OnUninstalled::kEventName);
}
diff --git a/chrome/browser/extensions/api/management/management_api.h b/chrome/browser/extensions/api/management/management_api.h
index 89f0e20..d26179b 100644
--- a/chrome/browser/extensions/api/management/management_api.h
+++ b/chrome/browser/extensions/api/management/management_api.h
@@ -247,8 +247,10 @@ class ManagementEventRouter : public ExtensionRegistryObserver {
virtual void OnExtensionInstalled(content::BrowserContext* browser_context,
const Extension* extension,
bool is_update) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// Dispatches management api events to listening extensions.
void BroadcastEvent(const Extension* extension, const char* event_name);
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index 75387a9..c9e9f4a 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -78,8 +78,10 @@ class ManagedValueStoreCache::ExtensionTracker
bool is_update,
bool from_ephemeral,
const std::string& old_name) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// Handler for the signal from ExtensionSystem::ready().
void OnExtensionsReady();
@@ -137,7 +139,8 @@ void ManagedValueStoreCache::ExtensionTracker::OnExtensionWillBeInstalled(
void ManagedValueStoreCache::ExtensionTracker::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
if (!ExtensionSystem::Get(profile_)->ready().is_signaled())
return;
if (extension && UsesManagedStorage(extension)) {
diff --git a/chrome/browser/extensions/error_console/error_console.cc b/chrome/browser/extensions/error_console/error_console.cc
index d92fac8..b5b1733 100644
--- a/chrome/browser/extensions/error_console/error_console.cc
+++ b/chrome/browser/extensions/error_console/error_console.cc
@@ -239,7 +239,8 @@ void ErrorConsole::OnExtensionInstalled(
void ErrorConsole::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
errors_.Remove(extension->id());
}
diff --git a/chrome/browser/extensions/error_console/error_console.h b/chrome/browser/extensions/error_console/error_console.h
index 8c5bb52..3553c46 100644
--- a/chrome/browser/extensions/error_console/error_console.h
+++ b/chrome/browser/extensions/error_console/error_console.h
@@ -135,8 +135,10 @@ class ErrorConsole : public content::NotificationObserver,
virtual void OnExtensionInstalled(content::BrowserContext* browser_context,
const Extension* extension,
bool is_update) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// Add manifest errors from an extension's install warnings.
void AddManifestErrorsForExtension(const Extension* extension);
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index cdcb71a..e131ae1 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -43,6 +43,7 @@
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_set.h"
#include "sync/api/string_ordinal.h"
@@ -552,7 +553,7 @@ void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) {
ExtensionService* service = extensions::ExtensionSystem::Get(
profile())->extension_service();
service->UninstallExtension(
- extension_id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ extension_id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
}
void ExtensionBrowserTest::DisableExtension(const std::string& extension_id) {
diff --git a/chrome/browser/extensions/extension_context_menu_model.cc b/chrome/browser/extensions/extension_context_menu_model.cc
index e06d3a7..1890a0e 100644
--- a/chrome/browser/extensions/extension_context_menu_model.cc
+++ b/chrome/browser/extensions/extension_context_menu_model.cc
@@ -23,6 +23,7 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/management_policy.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -146,9 +147,8 @@ void ExtensionContextMenuModel::ExtensionUninstallAccepted() {
if (GetExtension()) {
extensions::ExtensionSystem::Get(profile_)
->extension_service()
- ->UninstallExtension(extension_id_,
- ExtensionService::UNINSTALL_REASON_USER_INITIATED,
- NULL);
+ ->UninstallExtension(
+ extension_id_, extensions::UNINSTALL_REASON_USER_INITIATED, NULL);
}
Release();
}
diff --git a/chrome/browser/extensions/extension_disabled_ui.cc b/chrome/browser/extensions/extension_disabled_ui.cc
index e3b3ea7..ea131d5 100644
--- a/chrome/browser/extensions/extension_disabled_ui.cc
+++ b/chrome/browser/extensions/extension_disabled_ui.cc
@@ -33,6 +33,7 @@
#include "content/public/browser/notification_source.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/image_loader.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
@@ -366,9 +367,7 @@ bool ExtensionDisabledGlobalError::ShouldCloseOnDeactivate() const {
void ExtensionDisabledGlobalError::ExtensionUninstallAccepted() {
service_->UninstallExtension(
- extension_->id(),
- ExtensionService::UNINSTALL_REASON_EXTENSION_DISABLED,
- NULL);
+ extension_->id(), extensions::UNINSTALL_REASON_EXTENSION_DISABLED, NULL);
}
void ExtensionDisabledGlobalError::ExtensionUninstallCanceled() {
diff --git a/chrome/browser/extensions/extension_gcm_app_handler.cc b/chrome/browser/extensions/extension_gcm_app_handler.cc
index 8791df0..c294dfc 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler.cc
+++ b/chrome/browser/extensions/extension_gcm_app_handler.cc
@@ -131,7 +131,8 @@ void ExtensionGCMAppHandler::OnExtensionUnloaded(
void ExtensionGCMAppHandler::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
if (IsGCMPermissionEnabled(extension)) {
GetGCMDriver()->Unregister(
extension->id(),
diff --git a/chrome/browser/extensions/extension_gcm_app_handler.h b/chrome/browser/extensions/extension_gcm_app_handler.h
index a61dc25..666364f 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler.h
+++ b/chrome/browser/extensions/extension_gcm_app_handler.h
@@ -74,8 +74,10 @@ private:
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
void AddDummyAppHandler();
void RemoveDummyAppHandler();
diff --git a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
index 76c3662..412abf1 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
+++ b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc
@@ -43,6 +43,7 @@
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
@@ -334,7 +335,7 @@ class ExtensionGCMAppHandlerTest : public testing::Test {
void UninstallExtension(const Extension* extension) {
extension_service_->UninstallExtension(
- extension->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ extension->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
}
void SignIn(const std::string& username) {
diff --git a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
index 54fadca..d71f40e 100644
--- a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
+++ b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
@@ -25,6 +25,7 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/feature_switch.h"
@@ -720,11 +721,11 @@ TEST_F(ExtensionMessageBubbleTest, MAYBE_SettingsApiControllerTest) {
// Clean up after ourselves.
service_->UninstallExtension(
- kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId1, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
service_->UninstallExtension(
- kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId2, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
service_->UninstallExtension(
- kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId3, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
}
}
@@ -822,11 +823,11 @@ TEST_F(ExtensionMessageBubbleTest, MAYBE_NtpOverriddenControllerTest) {
// Clean up after ourselves.
service_->UninstallExtension(
- kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId1, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
service_->UninstallExtension(
- kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId2, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
service_->UninstallExtension(
- kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId3, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
}
void SetInstallTime(const std::string& extension_id,
@@ -945,11 +946,11 @@ TEST_F(ExtensionMessageBubbleTest, MAYBE_ProxyOverriddenControllerTest) {
// Clean up after ourselves.
service_->UninstallExtension(
- kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId1, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
service_->UninstallExtension(
- kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId2, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
service_->UninstallExtension(
- kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kId3, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
}
} // namespace extensions
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 03d1faf..22f001b 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -60,6 +60,7 @@
#include "extensions/browser/install_flag.h"
#include "extensions/browser/pref_names.h"
#include "extensions/browser/runtime_data.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/browser/update_observer.h"
#include "extensions/common/extension_messages.h"
#include "extensions/common/feature_switch.h"
@@ -140,7 +141,8 @@ void ExtensionService::CheckExternalUninstall(const std::string& id) {
<< "with id: " << id;
return;
}
- UninstallExtension(id, UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION, NULL);
+ UninstallExtension(
+ id, extensions::UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION, NULL);
}
void ExtensionService::SetFileTaskRunnerForTesting(
@@ -209,7 +211,7 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound(
bool ExtensionService::UninstallExtensionHelper(
ExtensionService* extensions_service,
const std::string& extension_id,
- UninstallReason reason) {
+ extensions::UninstallReason reason) {
// We can't call UninstallExtension with an invalid extension ID.
if (!extensions_service->GetInstalledExtension(extension_id)) {
LOG(WARNING) << "Attempted uninstallation of non-existent extension with "
@@ -677,7 +679,7 @@ bool ExtensionService::UninstallExtension(
// "transient" because the process of uninstalling may cause the reference
// to become invalid. Instead, use |extenson->id()|.
const std::string& transient_extension_id,
- UninstallReason reason,
+ extensions::UninstallReason reason,
base::string16* error) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -697,9 +699,9 @@ bool ExtensionService::UninstallExtension(
// else, like include an enum IS_INTERNAL_UNINSTALL or IS_USER_UNINSTALL so
// we don't do this.
bool external_uninstall =
- (reason == UNINSTALL_REASON_INTERNAL_MANAGEMENT) ||
- (reason == UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION) ||
- (reason == UNINSTALL_REASON_ORPHANED_SHARED_MODULE);
+ (reason == extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT) ||
+ (reason == extensions::UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION) ||
+ (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE);
if (!external_uninstall &&
!system_->management_policy()->UserMayModifySettings(
extension.get(), error)) {
@@ -748,7 +750,8 @@ bool ExtensionService::UninstallExtension(
chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED,
content::Source<Profile>(profile_),
content::Details<const Extension>(extension.get()));
- ExtensionRegistry::Get(profile_)->TriggerOnUninstalled(extension.get());
+ ExtensionRegistry::Get(profile_)
+ ->TriggerOnUninstalled(extension.get(), reason);
if (extension_sync_service_) {
extension_sync_service_->ProcessSyncUninstallExtension(extension->id(),
@@ -1290,7 +1293,8 @@ void ExtensionService::RemoveComponentExtension(
chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED,
content::Source<Profile>(profile_),
content::Details<const Extension>(extension.get()));
- ExtensionRegistry::Get(profile_)->TriggerOnUninstalled(extension.get());
+ ExtensionRegistry::Get(profile_)->TriggerOnUninstalled(
+ extension.get(), extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT);
}
}
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index 95bd11b..64a5980 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -25,6 +25,7 @@
#include "extensions/browser/install_flag.h"
#include "extensions/browser/management_policy.h"
#include "extensions/browser/process_manager.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
@@ -155,28 +156,11 @@ class ExtensionService
public content::NotificationObserver,
public extensions::Blacklist::Observer {
public:
- enum UninstallReason {
- UNINSTALL_REASON_FOR_TESTING, // Used for testing code only
- UNINSTALL_REASON_USER_INITIATED, // User performed some UI gesture
- UNINSTALL_REASON_EXTENSION_DISABLED, // Extension disabled due to error
- UNINSTALL_REASON_STORAGE_THRESHOLD_EXCEEDED,
- UNINSTALL_REASON_INSTALL_CANCELED,
- UNINSTALL_REASON_MANAGEMENT_API,
- UNINSTALL_REASON_SYNC,
- UNINSTALL_REASON_ORPHANED_THEME,
- UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
- // The entries below imply bypassing checking user has permission to
- // uninstall the corresponding extension id.
- UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION,
- UNINSTALL_REASON_ORPHANED_SHARED_MODULE,
- UNINSTALL_REASON_INTERNAL_MANAGEMENT // Internal extensions (see usages)
- };
-
// Attempts to uninstall an extension from a given ExtensionService. Returns
// true iff the target extension exists.
static bool UninstallExtensionHelper(ExtensionService* extensions_service,
const std::string& extension_id,
- UninstallReason reason);
+ extensions::UninstallReason reason);
// Constructor stores pointers to |profile| and |extension_prefs| but
// ownership remains at caller.
@@ -265,7 +249,7 @@ class ExtensionService
// with extensions that exist. |reason| lets the caller specify why the
// extension is uninstalled.
virtual bool UninstallExtension(const std::string& extension_id,
- UninstallReason reason,
+ extensions::UninstallReason reason,
base::string16* error);
// Enables the extension. If the extension is already enabled, does
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 9265527..f5c9d9a 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -89,6 +89,7 @@
#include "extensions/browser/management_policy.h"
#include "extensions/browser/pref_names.h"
#include "extensions/browser/test_management_policy.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
@@ -858,10 +859,10 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase,
// Uninstall it.
if (use_helper) {
EXPECT_TRUE(ExtensionService::UninstallExtensionHelper(
- service(), id, ExtensionService::UNINSTALL_REASON_FOR_TESTING));
+ service(), id, extensions::UNINSTALL_REASON_FOR_TESTING));
} else {
EXPECT_TRUE(service()->UninstallExtension(
- id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL));
+ id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL));
}
--expected_extensions_count_;
@@ -1435,8 +1436,10 @@ struct MockExtensionRegistryObserver
last_extension_installed = extension->id();
}
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE {
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE {
last_extension_uninstalled = extension->id();
}
@@ -3740,7 +3743,7 @@ TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsLoadFromPrefs) {
const Extension* extension =
(registry()->enabled_extensions().begin())->get();
EXPECT_TRUE(service()->UninstallExtension(
- extension->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL));
+ extension->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL));
EXPECT_EQ(0u, registry()->enabled_extensions().size());
// Ensure we cannot load it if management policy prohibits installation.
@@ -3788,7 +3791,7 @@ TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsUninstall) {
// Attempt to uninstall it.
EXPECT_FALSE(service()->UninstallExtension(
- good_crx, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL));
+ good_crx, extensions::UNINSTALL_REASON_FOR_TESTING, NULL));
EXPECT_EQ(1u, registry()->enabled_extensions().size());
EXPECT_TRUE(service()->GetExtensionById(good_crx, false));
@@ -4333,7 +4336,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) {
// Uninstall the extension.
service()->UninstallExtension(
- good_crx, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ good_crx, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
base::RunLoop().RunUntilIdle();
// Check that the cookie is gone.
@@ -4526,7 +4529,7 @@ TEST_F(ExtensionServiceTest, DISABLED_LoadExtension) {
std::string id = loaded_[0]->id();
EXPECT_FALSE(unloaded_id_.length());
service()->UninstallExtension(
- id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(id, unloaded_id_);
ASSERT_EQ(0u, loaded_.size());
@@ -4639,7 +4642,7 @@ void ExtensionServiceTest::TestExternalProvider(
bool no_uninstall =
GetManagementPolicy()->MustRemainEnabled(loaded_[0].get(), NULL);
service()->UninstallExtension(
- id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
base::RunLoop().RunUntilIdle();
base::FilePath install_path = extensions_install_dir().AppendASCII(id);
@@ -4704,7 +4707,7 @@ void ExtensionServiceTest::TestExternalProvider(
// User uninstalls.
loaded_.clear();
service()->UninstallExtension(
- id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
base::RunLoop().RunUntilIdle();
ASSERT_EQ(0u, loaded_.size());
diff --git a/chrome/browser/extensions/extension_storage_monitor.cc b/chrome/browser/extensions/extension_storage_monitor.cc
index b03ed58..8a01ba5 100644
--- a/chrome/browser/extensions/extension_storage_monitor.cc
+++ b/chrome/browser/extensions/extension_storage_monitor.cc
@@ -24,6 +24,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/image_loader.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "extensions/common/permissions/permissions_data.h"
@@ -303,7 +304,8 @@ void ExtensionStorageMonitor::OnExtensionWillBeInstalled(
void ExtensionStorageMonitor::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
RemoveNotificationForExtension(extension->id());
}
@@ -321,7 +323,7 @@ void ExtensionStorageMonitor::ExtensionUninstallAccepted() {
DCHECK(service);
service->UninstallExtension(
extension->id(),
- ExtensionService::UNINSTALL_REASON_STORAGE_THRESHOLD_EXCEEDED,
+ extensions::UNINSTALL_REASON_STORAGE_THRESHOLD_EXCEEDED,
NULL);
}
diff --git a/chrome/browser/extensions/extension_storage_monitor.h b/chrome/browser/extensions/extension_storage_monitor.h
index 6fa9c20..144c42e 100644
--- a/chrome/browser/extensions/extension_storage_monitor.h
+++ b/chrome/browser/extensions/extension_storage_monitor.h
@@ -69,8 +69,10 @@ class ExtensionStorageMonitor : public KeyedService,
bool is_update,
bool from_ephemeral,
const std::string& old_name) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// Overridden from ExtensionUninstallDialog::Delegate:
virtual void ExtensionUninstallAccepted() OVERRIDE;
diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc
index 82d93bb..95222d4 100644
--- a/chrome/browser/extensions/extension_sync_service.cc
+++ b/chrome/browser/extensions/extension_sync_service.cc
@@ -28,6 +28,7 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
#include "extensions/common/feature_switch.h"
@@ -450,7 +451,7 @@ bool ExtensionSyncService::ProcessExtensionSyncDataHelper(
// Handle uninstalls first.
if (extension_sync_data.uninstalled()) {
if (!extension_service_->UninstallExtensionHelper(
- extension_service_, id, ExtensionService::UNINSTALL_REASON_SYNC)) {
+ extension_service_, id, extensions::UNINSTALL_REASON_SYNC)) {
LOG(WARNING) << "Could not uninstall extension " << id
<< " for sync";
}
diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc
index b4d223c..d155b4a 100644
--- a/chrome/browser/extensions/extension_toolbar_model.cc
+++ b/chrome/browser/extensions/extension_toolbar_model.cc
@@ -192,7 +192,8 @@ void ExtensionToolbarModel::OnExtensionUnloaded(
void ExtensionToolbarModel::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
// Remove the extension id from the ordered list, if it exists (the extension
// might not be represented in the list because it might not have an icon).
ExtensionIdList::iterator pos =
diff --git a/chrome/browser/extensions/extension_toolbar_model.h b/chrome/browser/extensions/extension_toolbar_model.h
index 3626f84..d44b68f 100644
--- a/chrome/browser/extensions/extension_toolbar_model.h
+++ b/chrome/browser/extensions/extension_toolbar_model.h
@@ -151,8 +151,10 @@ class ExtensionToolbarModel : public content::NotificationObserver,
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// To be called after the extension service is ready; gets loaded extensions
// from the extension service and their saved order from the pref service
diff --git a/chrome/browser/extensions/external_install_error.cc b/chrome/browser/extensions/external_install_error.cc
index 6547d23..5378607 100644
--- a/chrome/browser/extensions/external_install_error.cc
+++ b/chrome/browser/extensions/external_install_error.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "grit/generated_resources.h"
@@ -284,10 +285,9 @@ void ExternalInstallError::InstallUIAbort(bool user_initiated) {
if (user_initiated && GetExtension()) {
ExtensionSystem::Get(browser_context_)
->extension_service()
- ->UninstallExtension(
- extension_id_,
- ExtensionService::UNINSTALL_REASON_INSTALL_CANCELED,
- NULL); // Ignore error.
+ ->UninstallExtension(extension_id_,
+ extensions::UNINSTALL_REASON_INSTALL_CANCELED,
+ NULL); // Ignore error.
// Since the manager listens for the extension to be removed, this will
// remove the error...
} else {
diff --git a/chrome/browser/extensions/external_install_manager.cc b/chrome/browser/extensions/external_install_manager.cc
index c8bd112..9004bcc 100644
--- a/chrome/browser/extensions/external_install_manager.cc
+++ b/chrome/browser/extensions/external_install_manager.cc
@@ -195,7 +195,8 @@ void ExternalInstallManager::OnExtensionInstalled(
void ExternalInstallManager::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
if (IsUnacknowledgedExternalExtension(extension))
LogExternalExtensionEvent(extension, EXTERNAL_EXTENSION_UNINSTALLED);
}
diff --git a/chrome/browser/extensions/external_install_manager.h b/chrome/browser/extensions/external_install_manager.h
index 226b529..29b3fd1 100644
--- a/chrome/browser/extensions/external_install_manager.h
+++ b/chrome/browser/extensions/external_install_manager.h
@@ -61,8 +61,10 @@ class ExternalInstallManager : public ExtensionRegistryObserver,
virtual void OnExtensionInstalled(content::BrowserContext* browser_context,
const Extension* extension,
bool is_update) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// content::NotificationObserver implementation.
virtual void Observe(int type,
diff --git a/chrome/browser/extensions/shared_module_service.cc b/chrome/browser/extensions/shared_module_service.cc
index 2b595ff..6478bdb 100644
--- a/chrome/browser/extensions/shared_module_service.cc
+++ b/chrome/browser/extensions/shared_module_service.cc
@@ -13,6 +13,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
namespace extensions {
@@ -166,7 +167,7 @@ void SharedModuleService::PruneSharedModules() {
continue;
service->UninstallExtension(
*shared_modules_iter,
- ExtensionService::UNINSTALL_REASON_ORPHANED_SHARED_MODULE,
+ extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE,
NULL); // Ignore error.
}
}
@@ -181,7 +182,8 @@ void SharedModuleService::OnExtensionInstalled(
void SharedModuleService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
PruneSharedModules();
}
diff --git a/chrome/browser/extensions/shared_module_service.h b/chrome/browser/extensions/shared_module_service.h
index 997273d..9859e34 100644
--- a/chrome/browser/extensions/shared_module_service.h
+++ b/chrome/browser/extensions/shared_module_service.h
@@ -62,8 +62,10 @@ class SharedModuleService : public ExtensionRegistryObserver {
virtual void OnExtensionInstalled(content::BrowserContext* browser_context,
const Extension* extension,
bool is_update) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
diff --git a/chrome/browser/extensions/shared_module_service_unittest.cc b/chrome/browser/extensions/shared_module_service_unittest.cc
index de21dcf..e8c5c0a 100644
--- a/chrome/browser/extensions/shared_module_service_unittest.cc
+++ b/chrome/browser/extensions/shared_module_service_unittest.cc
@@ -13,6 +13,7 @@
#include "chrome/common/extensions/features/feature_channel.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/install_flag.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/id_util.h"
#include "extensions/common/value_builder.h"
@@ -144,8 +145,8 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUninstall) {
// Uninstall the extension that imports our module.
base::string16 error;
service()->UninstallExtension(importing_extension->id(),
- ExtensionService::UNINSTALL_REASON_FOR_TESTING,
- &error);
+ extensions::UNINSTALL_REASON_FOR_TESTING,
+ &error);
EXPECT_TRUE(error.empty());
// Since the module was only referenced by that single extension, it should
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index f6d2c87..91eebc1 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -124,6 +124,7 @@
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/process_manager.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
@@ -708,7 +709,7 @@ class PolicyTest : public InProcessBrowserTest {
: chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED,
content::NotificationService::AllSources());
extension_service()->UninstallExtension(
- id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
observer.Wait();
}
diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc
index 607ec1d..29b883d 100644
--- a/chrome/browser/search/hotword_service.cc
+++ b/chrome/browser/search/hotword_service.cc
@@ -26,6 +26,7 @@
#include "content/public/browser/plugin_service.h"
#include "content/public/common/webplugininfo.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/one_shot_event.h"
#include "grit/generated_resources.h"
@@ -255,7 +256,8 @@ void HotwordService::Observe(int type,
void HotwordService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) {
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) {
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (extension->id() != extension_misc::kHotwordExtensionId ||
@@ -362,7 +364,7 @@ bool HotwordService::UninstallHotwordExtension(
base::string16 error;
if (!extension_service->UninstallExtension(
extension_misc::kHotwordExtensionId,
- ExtensionService::UNINSTALL_REASON_INTERNAL_MANAGEMENT,
+ extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT,
&error)) {
LOG(WARNING) << "Cannot uninstall extension with id "
<< extension_misc::kHotwordExtensionId
diff --git a/chrome/browser/search/hotword_service.h b/chrome/browser/search/hotword_service.h
index 8f44e3d..457319e 100644
--- a/chrome/browser/search/hotword_service.h
+++ b/chrome/browser/search/hotword_service.h
@@ -54,7 +54,8 @@ class HotwordService : public content::NotificationObserver,
bool is_update) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// Checks for whether all the necessary files have downloaded to allow for
// using the extension.
diff --git a/chrome/browser/sync/test/integration/extensions_helper.cc b/chrome/browser/sync/test/integration/extensions_helper.cc
index 7ebf751..34361de 100644
--- a/chrome/browser/sync/test/integration/extensions_helper.cc
+++ b/chrome/browser/sync/test/integration/extensions_helper.cc
@@ -161,7 +161,8 @@ class ExtensionsMatchChecker : public StatusChangeChecker,
bool is_update) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
void Wait();
@@ -230,7 +231,8 @@ void ExtensionsMatchChecker::OnExtensionInstalled(
void ExtensionsMatchChecker::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) {
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) {
CheckExitCondition();
}
diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc
index 7f51c71..eb0b9d5 100644
--- a/chrome/browser/sync/test/integration/sync_extension_helper.cc
+++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc
@@ -18,6 +18,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/install_flag.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/id_util.h"
@@ -83,7 +84,7 @@ void SyncExtensionHelper::UninstallExtension(
ExtensionService::UninstallExtensionHelper(
extensions::ExtensionSystem::Get(profile)->extension_service(),
extensions::id_util::GenerateId(name),
- ExtensionService::UNINSTALL_REASON_SYNC);
+ extensions::UNINSTALL_REASON_SYNC);
}
std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames(
diff --git a/chrome/browser/sync_file_system/sync_file_system_service.cc b/chrome/browser/sync_file_system/sync_file_system_service.cc
index 31ba68c..6789e99 100644
--- a/chrome/browser/sync_file_system/sync_file_system_service.cc
+++ b/chrome/browser/sync_file_system/sync_file_system_service.cc
@@ -662,7 +662,8 @@ void SyncFileSystemService::OnExtensionUnloaded(
void SyncFileSystemService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
RemoteFileSyncService::UninstallFlag flag =
RemoteFileSyncService::UNINSTALL_AND_PURGE_REMOTE;
// If it's loaded from an unpacked package and with key: field,
diff --git a/chrome/browser/sync_file_system/sync_file_system_service.h b/chrome/browser/sync_file_system/sync_file_system_service.h
index 31b3e32..54dabac 100644
--- a/chrome/browser/sync_file_system/sync_file_system_service.h
+++ b/chrome/browser/sync_file_system/sync_file_system_service.h
@@ -145,7 +145,8 @@ class SyncFileSystemService
extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
virtual void OnExtensionLoaded(
content::BrowserContext* browser_context,
const extensions::Extension* extension) OVERRIDE;
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index ed7d1c1..7f589bd 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -26,6 +26,7 @@
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "grit/theme_resources.h"
@@ -372,9 +373,7 @@ void ThemeService::RemoveUnusedThemes(bool ignore_infobars) {
for (size_t i = 0; i < remove_list.size(); ++i) {
service->UninstallExtension(
- remove_list[i],
- ExtensionService::UNINSTALL_REASON_ORPHANED_THEME,
- NULL);
+ remove_list[i], extensions::UNINSTALL_REASON_ORPHANED_THEME, NULL);
}
}
diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc
index 45f82e4..e4823dc 100644
--- a/chrome/browser/themes/theme_service_unittest.cc
+++ b/chrome/browser/themes/theme_service_unittest.cc
@@ -21,6 +21,7 @@
#include "chrome/test/base/testing_profile_manager.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_registry.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -120,7 +121,7 @@ TEST_F(ThemeServiceTest, ThemeInstallUninstall) {
// Now uninstall the extension, should revert to the default theme.
service_->UninstallExtension(
- extension_id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ extension_id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
EXPECT_TRUE(theme_service->UsingDefaultTheme());
}
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc
index 2f0cdda..c1a03b6 100644
--- a/chrome/browser/ui/app_list/app_list_syncable_service.cc
+++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -18,6 +18,7 @@
#include "content/public/browser/notification_source.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "grit/generated_resources.h"
#include "sync/api/sync_change_processor.h"
#include "sync/api/sync_data.h"
@@ -117,8 +118,7 @@ bool IsUnRemovableDefaultApp(const std::string& id) {
void UninstallExtension(ExtensionService* service, const std::string& id) {
if (service && service->GetInstalledExtension(id))
- service->UninstallExtension(
- id, ExtensionService::UNINSTALL_REASON_SYNC, NULL);
+ service->UninstallExtension(id, extensions::UNINSTALL_REASON_SYNC, NULL);
}
bool GetAppListItemType(AppListItem* item,
diff --git a/chrome/browser/ui/app_list/extension_app_model_builder.cc b/chrome/browser/ui/app_list/extension_app_model_builder.cc
index f97fd85..9c27a75 100644
--- a/chrome/browser/ui/app_list/extension_app_model_builder.cc
+++ b/chrome/browser/ui/app_list/extension_app_model_builder.cc
@@ -160,7 +160,8 @@ void ExtensionAppModelBuilder::OnExtensionUnloaded(
void ExtensionAppModelBuilder::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) {
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) {
if (service_) {
DVLOG(2) << service_ << ": OnExtensionUninstalled: "
<< extension->id().substr(0, 8);
diff --git a/chrome/browser/ui/app_list/extension_app_model_builder.h b/chrome/browser/ui/app_list/extension_app_model_builder.h
index a201f6f..9313af0 100644
--- a/chrome/browser/ui/app_list/extension_app_model_builder.h
+++ b/chrome/browser/ui/app_list/extension_app_model_builder.h
@@ -79,7 +79,8 @@ class ExtensionAppModelBuilder : public extensions::InstallObserver,
extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
virtual void OnShutdown(extensions::ExtensionRegistry* registry) OVERRIDE;
// AppListItemListObserver.
diff --git a/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc b/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc
index 7484e7cc..195ec58 100644
--- a/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc
+++ b/chrome/browser/ui/app_list/extension_app_model_builder_unittest.cc
@@ -23,6 +23,7 @@
#include "chrome/test/base/testing_profile.h"
#include "extensions/browser/app_sorting.h"
#include "extensions/browser/extension_prefs.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/manifest.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -197,7 +198,7 @@ TEST_F(ExtensionAppModelBuilderTest, DisableAndEnable) {
TEST_F(ExtensionAppModelBuilderTest, Uninstall) {
service_->UninstallExtension(
- kPackagedApp2Id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kPackagedApp2Id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
EXPECT_EQ(std::string("Packaged App 1,Hosted App"),
GetModelContent(model_.get()));
@@ -213,7 +214,7 @@ TEST_F(ExtensionAppModelBuilderTest, UninstallTerminatedApp) {
service_->TrackTerminatedExtensionForTest(app);
service_->UninstallExtension(
- kPackagedApp2Id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kPackagedApp2Id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
EXPECT_EQ(std::string("Packaged App 1,Hosted App"),
GetModelContent(model_.get()));
diff --git a/chrome/browser/ui/app_list/extension_uninstaller.cc b/chrome/browser/ui/app_list/extension_uninstaller.cc
index dd4b23f..138b7ae 100644
--- a/chrome/browser/ui/app_list/extension_uninstaller.cc
+++ b/chrome/browser/ui/app_list/extension_uninstaller.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
ExtensionUninstaller::ExtensionUninstaller(
@@ -43,7 +44,7 @@ void ExtensionUninstaller::ExtensionUninstallAccepted() {
service->GetInstalledExtension(app_id_);
if (extension) {
service->UninstallExtension(
- app_id_, ExtensionService::UNINSTALL_REASON_USER_INITIATED, NULL);
+ app_id_, extensions::UNINSTALL_REASON_USER_INITIATED, NULL);
}
controller_->OnCloseChildDialog();
CleanUp();
diff --git a/chrome/browser/ui/app_list/recommended_apps.cc b/chrome/browser/ui/app_list/recommended_apps.cc
index b7913d1..f25543f 100644
--- a/chrome/browser/ui/app_list/recommended_apps.cc
+++ b/chrome/browser/ui/app_list/recommended_apps.cc
@@ -118,7 +118,8 @@ void RecommendedApps::OnExtensionUnloaded(
void RecommendedApps::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) {
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) {
Update();
}
diff --git a/chrome/browser/ui/app_list/recommended_apps.h b/chrome/browser/ui/app_list/recommended_apps.h
index d4a0fb7..25f82cd 100644
--- a/chrome/browser/ui/app_list/recommended_apps.h
+++ b/chrome/browser/ui/app_list/recommended_apps.h
@@ -57,7 +57,8 @@ class RecommendedApps : public extensions::ExtensionRegistryObserver {
extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
Profile* profile_;
PrefChangeRegistrar pref_change_registrar_;
diff --git a/chrome/browser/ui/app_list/search/app_result.cc b/chrome/browser/ui/app_list/search/app_result.cc
index 5a966f1..098b5fc 100644
--- a/chrome/browser/ui/app_list/search/app_result.cc
+++ b/chrome/browser/ui/app_list/search/app_result.cc
@@ -192,7 +192,8 @@ void AppResult::OnExtensionLoaded(content::BrowserContext* browser_context,
}
void AppResult::OnExtensionUninstalled(content::BrowserContext* browser_context,
- const extensions::Extension* extension) {
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) {
if (extension->id() != app_id_)
return;
diff --git a/chrome/browser/ui/app_list/search/app_result.h b/chrome/browser/ui/app_list/search/app_result.h
index 7771433..2b39739 100644
--- a/chrome/browser/ui/app_list/search/app_result.h
+++ b/chrome/browser/ui/app_list/search/app_result.h
@@ -78,7 +78,8 @@ class AppResult : public ChromeSearchResult,
const extensions::Extension* extension) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
virtual void OnShutdown(extensions::ExtensionRegistry* registry) OVERRIDE;
Profile* profile_;
diff --git a/chrome/browser/ui/app_list/search/app_search_provider.cc b/chrome/browser/ui/app_list/search/app_search_provider.cc
index 9237b07..849d661 100644
--- a/chrome/browser/ui/app_list/search/app_search_provider.cc
+++ b/chrome/browser/ui/app_list/search/app_search_provider.cc
@@ -104,7 +104,8 @@ void AppSearchProvider::OnExtensionLoaded(
void AppSearchProvider::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) {
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) {
RefreshApps();
}
diff --git a/chrome/browser/ui/app_list/search/app_search_provider.h b/chrome/browser/ui/app_list/search/app_search_provider.h
index cccf9df..436dbc2 100644
--- a/chrome/browser/ui/app_list/search/app_search_provider.h
+++ b/chrome/browser/ui/app_list/search/app_search_provider.h
@@ -46,7 +46,8 @@ class AppSearchProvider : public SearchProvider,
const extensions::Extension* extension) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
Profile* profile_;
AppListControllerDelegate* list_controller_;
diff --git a/chrome/browser/ui/app_list/search/app_search_provider_unittest.cc b/chrome/browser/ui/app_list/search/app_search_provider_unittest.cc
index 451eb5b..faaae0d 100644
--- a/chrome/browser/ui/app_list/search/app_search_provider_unittest.cc
+++ b/chrome/browser/ui/app_list/search/app_search_provider_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/test/base/testing_profile.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension_set.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -85,7 +86,7 @@ TEST_F(AppSearchProviderTest, DisableAndEnable) {
TEST_F(AppSearchProviderTest, Uninstall) {
EXPECT_EQ("Packaged App 1", RunQuery("pa1"));
service_->UninstallExtension(
- kPackagedApp1Id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL);
+ kPackagedApp1Id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
EXPECT_EQ("", RunQuery("pa1"));
// Let uninstall code to clean up.
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 0585f14..6045b99 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -80,6 +80,7 @@
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_set.h"
#include "grit/chromium_strings.h"
@@ -1307,9 +1308,8 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_TabClosingWhenRemovingExtension) {
// Uninstall the extension and make sure TabClosing is sent.
ExtensionService* service = extensions::ExtensionSystem::Get(
browser()->profile())->extension_service();
- service->UninstallExtension(GetExtension()->id(),
- ExtensionService::UNINSTALL_REASON_FOR_TESTING,
- NULL);
+ service->UninstallExtension(
+ GetExtension()->id(), extensions::UNINSTALL_REASON_FOR_TESTING, NULL);
EXPECT_EQ(1, observer.closing_count());
model->RemoveObserver(&observer);
diff --git a/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm b/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm
index c9db22c..9e04e47 100644
--- a/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm
+++ b/chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac_browsertest.mm
@@ -18,6 +18,7 @@
#include "chrome/browser/ui/browser_iterator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_switches.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
namespace {
@@ -150,7 +151,7 @@ IN_PROC_BROWSER_TEST_F(AppShimMenuControllerBrowserTest,
ExtensionService::UninstallExtensionHelper(
extension_service(),
app_1_->id(),
- ExtensionService::UNINSTALL_REASON_FOR_TESTING);
+ extensions::UNINSTALL_REASON_FOR_TESTING);
CheckNoAppMenus();
}
diff --git a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm
index 1ef4a50..548b2a0 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_action_context_menu_controller.mm
@@ -26,6 +26,7 @@
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -55,7 +56,7 @@ class AsyncUninstaller : public extensions::ExtensionUninstallDialog::Delegate {
extensions::ExtensionSystem::Get(profile_)
->extension_service()
->UninstallExtension(extension_->id(),
- ExtensionService::UNINSTALL_REASON_USER_INITIATED,
+ extensions::UNINSTALL_REASON_USER_INITIATED,
NULL);
}
virtual void ExtensionUninstallCanceled() OVERRIDE {}
diff --git a/chrome/browser/ui/extensions/extension_enable_flow.cc b/chrome/browser/ui/extensions/extension_enable_flow.cc
index be3454a..1689d41 100644
--- a/chrome/browser/ui/extensions/extension_enable_flow.cc
+++ b/chrome/browser/ui/extensions/extension_enable_flow.cc
@@ -142,7 +142,8 @@ void ExtensionEnableFlow::OnExtensionLoaded(
void ExtensionEnableFlow::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
if (extension->id() == extension_id_) {
StopObserving();
delegate_->ExtensionEnableFlowAborted(false);
diff --git a/chrome/browser/ui/extensions/extension_enable_flow.h b/chrome/browser/ui/extensions/extension_enable_flow.h
index 71da093..75db646 100644
--- a/chrome/browser/ui/extensions/extension_enable_flow.h
+++ b/chrome/browser/ui/extensions/extension_enable_flow.h
@@ -90,7 +90,8 @@ class ExtensionEnableFlow : public ExtensionInstallPrompt::Delegate,
const extensions::Extension* extension) OVERRIDE;
virtual void OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const extensions::Extension* extension) OVERRIDE;
+ const extensions::Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// ExtensionInstallPrompt::Delegate overrides:
virtual void InstallUIProceed() OVERRIDE;
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.cc
index db43a47..26bf4934 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.cc
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.cc
@@ -14,6 +14,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/management_policy.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -115,7 +116,7 @@ void AppInfoFooterPanel::ExtensionUninstallAccepted() {
ExtensionService* service =
extensions::ExtensionSystem::Get(profile_)->extension_service();
service->UninstallExtension(
- app_->id(), ExtensionService::UNINSTALL_REASON_USER_INITIATED, NULL);
+ app_->id(), extensions::UNINSTALL_REASON_USER_INITIATED, NULL);
// Close the App Info dialog as well (which will free the dialog too).
GetWidget()->Close();
diff --git a/chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc b/chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc
index 8db6baa..0f5ab10 100644
--- a/chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc
+++ b/chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc
@@ -16,6 +16,7 @@
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/pref_names.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -207,9 +208,7 @@ void BookmarkAppBubbleView::WindowClosing() {
if (remove_app_) {
GetExtensionService(profile_)->UninstallExtension(
- extension_id_,
- ExtensionService::UNINSTALL_REASON_INSTALL_CANCELED,
- NULL);
+ extension_id_, extensions::UNINSTALL_REASON_INSTALL_CANCELED, NULL);
} else {
ApplyEdits();
}
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 8960ce6..9d99cbb 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -78,6 +78,7 @@
#include "extensions/browser/lazy_background_task_queue.h"
#include "extensions/browser/management_policy.h"
#include "extensions/browser/pref_names.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
@@ -726,7 +727,8 @@ void ExtensionSettingsHandler::OnExtensionUnloaded(
void ExtensionSettingsHandler::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
MaybeUpdateAfterNotification();
}
@@ -755,7 +757,7 @@ void ExtensionSettingsHandler::ExtensionUninstallAccepted() {
extension_service_->UninstallExtension(
extension_id_prompting_,
- ExtensionService::UNINSTALL_REASON_USER_INITIATED,
+ extensions::UNINSTALL_REASON_USER_INITIATED,
NULL); // Error.
extension_id_prompting_ = "";
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.h b/chrome/browser/ui/webui/extensions/extension_settings_handler.h
index 4fdd9d0..d299a54 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.h
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.h
@@ -125,8 +125,10 @@ class ExtensionSettingsHandler
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionInfo::Reason reason) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
// ExtensionPrefsObserver implementation.
virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id,
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
index cd0a0d8..c1fd844 100644
--- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
+++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -52,6 +52,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/management_policy.h"
#include "extensions/browser/pref_names.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
@@ -791,7 +792,7 @@ void AppLauncherHandler::ExtensionUninstallAccepted() {
extension_service_->UninstallExtension(
extension_id_prompting_,
- ExtensionService::UNINSTALL_REASON_USER_INITIATED,
+ extensions::UNINSTALL_REASON_USER_INITIATED,
NULL);
CleanupAfterUninstall();
}
diff --git a/extensions/browser/extension_registry.cc b/extensions/browser/extension_registry.cc
index 30801bc..0c1a80d 100644
--- a/extensions/browser/extension_registry.cc
+++ b/extensions/browser/extension_registry.cc
@@ -76,11 +76,13 @@ void ExtensionRegistry::TriggerOnInstalled(const Extension* extension,
browser_context_, extension, is_update));
}
-void ExtensionRegistry::TriggerOnUninstalled(const Extension* extension) {
+void ExtensionRegistry::TriggerOnUninstalled(const Extension* extension,
+ UninstallReason reason) {
DCHECK(!GenerateInstalledExtensionsSet()->Contains(extension->id()));
- FOR_EACH_OBSERVER(ExtensionRegistryObserver,
- observers_,
- OnExtensionUninstalled(browser_context_, extension));
+ FOR_EACH_OBSERVER(
+ ExtensionRegistryObserver,
+ observers_,
+ OnExtensionUninstalled(browser_context_, extension, reason));
}
const Extension* ExtensionRegistry::GetExtensionById(const std::string& id,
diff --git a/extensions/browser/extension_registry.h b/extensions/browser/extension_registry.h
index eec137b..75724cd 100644
--- a/extensions/browser/extension_registry.h
+++ b/extensions/browser/extension_registry.h
@@ -11,6 +11,7 @@
#include "base/memory/ref_counted.h"
#include "base/observer_list.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension_set.h"
namespace content {
@@ -93,7 +94,7 @@ class ExtensionRegistry : public KeyedService {
// Invokes the observer method OnExtensionUninstalled(). The extension must
// not be any installed extension with |extension|'s ID.
- void TriggerOnUninstalled(const Extension* extension);
+ void TriggerOnUninstalled(const Extension* extension, UninstallReason reason);
// Find an extension by ID using |include_mask| to pick the sets to search:
// * enabled_extensions() --> ExtensionRegistry::ENABLED
diff --git a/extensions/browser/extension_registry_observer.h b/extensions/browser/extension_registry_observer.h
index 3ba22c7..31573b6 100644
--- a/extensions/browser/extension_registry_observer.h
+++ b/extensions/browser/extension_registry_observer.h
@@ -5,6 +5,7 @@
#ifndef EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_
#define EXTENSIONS_BROWSER_EXTENSION_REGISTRY_OBSERVER_H_
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/extension.h"
namespace content {
@@ -69,7 +70,8 @@ class ExtensionRegistryObserver {
// Called after an extension is uninstalled. The extension no longer exists in
// any of the ExtensionRegistry sets (enabled, disabled, etc.).
virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) {}
+ const Extension* extension,
+ UninstallReason reason) {}
// Notifies observers that the observed object is going away.
virtual void OnShutdown(ExtensionRegistry* registry) {}
diff --git a/extensions/browser/extension_registry_unittest.cc b/extensions/browser/extension_registry_unittest.cc
index 1836293..492bcb0 100644
--- a/extensions/browser/extension_registry_unittest.cc
+++ b/extensions/browser/extension_registry_unittest.cc
@@ -9,7 +9,7 @@
#include "base/memory/ref_counted.h"
#include "base/strings/string_util.h"
#include "extensions/browser/extension_registry_observer.h"
-#include "extensions/common/extension.h"
+#include "extensions/browser/uninstall_reason.h"
#include "extensions/common/test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -69,8 +69,10 @@ class TestObserver : public ExtensionRegistryObserver {
installed_.push_back(extension);
}
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE {
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE {
uninstalled_.push_back(extension);
}
@@ -265,7 +267,8 @@ TEST_F(ExtensionRegistryTest, Observer) {
EXPECT_TRUE(HasSingleExtension(observer.unloaded(), extension.get()));
registry.Shutdown();
- registry.TriggerOnUninstalled(extension);
+ registry.TriggerOnUninstalled(extension,
+ extensions::UNINSTALL_REASON_FOR_TESTING);
EXPECT_TRUE(observer.installed().empty());
EXPECT_TRUE(HasSingleExtension(observer.uninstalled(), extension.get()));
diff --git a/extensions/browser/state_store.cc b/extensions/browser/state_store.cc
index ced256a..82d7caa 100644
--- a/extensions/browser/state_store.cc
+++ b/extensions/browser/state_store.cc
@@ -159,7 +159,8 @@ void StateStore::OnExtensionWillBeInstalled(
void StateStore::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
RemoveKeysForExtension(extension->id());
}
diff --git a/extensions/browser/state_store.h b/extensions/browser/state_store.h
index 3c052fa..5f2b0dc 100644
--- a/extensions/browser/state_store.h
+++ b/extensions/browser/state_store.h
@@ -76,8 +76,10 @@ class StateStore : public base::SupportsWeakPtr<StateStore>,
void RemoveKeysForExtension(const std::string& extension_id);
// ExtensionRegistryObserver implementation.
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
virtual void OnExtensionWillBeInstalled(
content::BrowserContext* browser_context,
const Extension* extension,
diff --git a/extensions/browser/test_extension_registry_observer.cc b/extensions/browser/test_extension_registry_observer.cc
index 9982f2d..ff678c6 100644
--- a/extensions/browser/test_extension_registry_observer.cc
+++ b/extensions/browser/test_extension_registry_observer.cc
@@ -80,7 +80,8 @@ void TestExtensionRegistryObserver::OnExtensionWillBeInstalled(
void TestExtensionRegistryObserver::OnExtensionUninstalled(
content::BrowserContext* browser_context,
- const Extension* extension) {
+ const Extension* extension,
+ extensions::UninstallReason reason) {
if (extension->id() == extension_id_)
uninstalled_waiter_->OnObserved();
}
diff --git a/extensions/browser/test_extension_registry_observer.h b/extensions/browser/test_extension_registry_observer.h
index ce3beb0..70a797d 100644
--- a/extensions/browser/test_extension_registry_observer.h
+++ b/extensions/browser/test_extension_registry_observer.h
@@ -33,8 +33,10 @@ class TestExtensionRegistryObserver : public ExtensionRegistryObserver {
bool is_update,
bool from_ephemeral,
const std::string& old_name) OVERRIDE;
- virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
- const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUninstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ extensions::UninstallReason reason) OVERRIDE;
virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
const Extension* extension) OVERRIDE;
virtual void OnExtensionUnloaded(
diff --git a/extensions/browser/uninstall_reason.h b/extensions/browser/uninstall_reason.h
new file mode 100644
index 0000000..728d47c
--- /dev/null
+++ b/extensions/browser/uninstall_reason.h
@@ -0,0 +1,29 @@
+// Copyright 2014 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 EXTENSIONS_BROWSER_UNINSTALL_REASON_H_
+#define EXTENSIONS_BROWSER_UNINSTALL_REASON_H_
+
+namespace extensions {
+
+enum UninstallReason {
+ UNINSTALL_REASON_FOR_TESTING, // Used for testing code only
+ UNINSTALL_REASON_USER_INITIATED, // User performed some UI gesture
+ UNINSTALL_REASON_EXTENSION_DISABLED, // Extension disabled due to error
+ UNINSTALL_REASON_STORAGE_THRESHOLD_EXCEEDED,
+ UNINSTALL_REASON_INSTALL_CANCELED,
+ UNINSTALL_REASON_MANAGEMENT_API,
+ UNINSTALL_REASON_SYNC,
+ UNINSTALL_REASON_ORPHANED_THEME,
+ UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION,
+ // The entries below imply bypassing checking user has permission to
+ // uninstall the corresponding extension id.
+ UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION,
+ UNINSTALL_REASON_ORPHANED_SHARED_MODULE,
+ UNINSTALL_REASON_INTERNAL_MANAGEMENT // Internal extensions (see usages)
+};
+
+} // extensions
+
+#endif // EXTENSIONS_BROWSER_UNINSTALL_REASON_H_
diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp
index 6c1a6f4..ea7bd5d 100644
--- a/extensions/extensions.gyp
+++ b/extensions/extensions.gyp
@@ -446,6 +446,7 @@
'browser/runtime_data.h',
'browser/state_store.cc',
'browser/state_store.h',
+ 'browser/uninstall_reason.h',
'browser/update_observer.h',
'browser/value_store/leveldb_value_store.cc',
'browser/value_store/leveldb_value_store.h',