diff options
author | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-03 14:45:14 +0000 |
---|---|---|
committer | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-03 14:45:14 +0000 |
commit | 99831013f958e62bad417a59151d43a97c8d7655 (patch) | |
tree | 34a9fa27dfc2d6e8de8e65b9656bc19957a65996 | |
parent | 3f2ffd08fad01d7cd0aa62ebd4cf37bebe7feeb0 (diff) | |
download | chromium_src-99831013f958e62bad417a59151d43a97c8d7655.zip chromium_src-99831013f958e62bad417a59151d43a97c8d7655.tar.gz chromium_src-99831013f958e62bad417a59151d43a97c8d7655.tar.bz2 |
Revert 281130 "Replace "external_install" boolean parameter with..."
This seems to cause HotwordServiceTest.UninstallReinstallTriggeredCorrectly
to fail on Mac and Linux bots.
> Replace "external_install" boolean parameter with explicit enumeration in ExtensionUninstall method.
>
> The intent is to be able to address issues found in https://code.google.com/p/chromium/issues/detail?id=84556#c39
>
> * This change should be a strict refactoring, and there should be no change of behavior wrt to extension uninstall behavior.
>
> * Identify a few specific reasons for extension uninstall and create enum values for them.
>
> * Run "git cl format"
>
>
> BUG=84556
> TBR=sky@chromium.org for trivial changes under chrome/browser, except chrome/browser/extensions (already lgtm'ed).
>
> Review URL: https://codereview.chromium.org/284103002
TBR=rpaquay@chromium.org
Review URL: https://codereview.chromium.org/365123002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281272 0039d316-1c4b-4281-b951-d872f2087c98
35 files changed, 92 insertions, 187 deletions
diff --git a/chrome/browser/apps/drive/drive_app_provider.cc b/chrome/browser/apps/drive/drive_app_provider.cc index 3aeb5a0..2bde9fe 100644 --- a/chrome/browser/apps/drive/drive_app_provider.cc +++ b/chrome/browser/apps/drive/drive_app_provider.cc @@ -82,9 +82,7 @@ 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, false, NULL); } } @@ -193,8 +191,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); + ->UninstallExtension(chrome_app_id, false, NULL); } void DriveAppProvider::OnDriveAppRegistryUpdated() { diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc index 869512a..529d8c0 100644 --- a/chrome/browser/apps/ephemeral_app_browsertest.cc +++ b/chrome/browser/apps/ephemeral_app_browsertest.cc @@ -242,10 +242,7 @@ void EphemeralAppTestBase::EvictApp(const std::string& app_id) { ExtensionService* service = ExtensionSystem::Get(profile())->extension_service(); ASSERT_TRUE(service); - service->UninstallExtension( - app_id, - ExtensionService::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION, - NULL); + service->UninstallExtension(app_id, false, NULL); uninstalled_signal.Wait(); } diff --git a/chrome/browser/apps/ephemeral_app_service.cc b/chrome/browser/apps/ephemeral_app_service.cc index da4a5d1..067de9c 100644 --- a/chrome/browser/apps/ephemeral_app_service.cc +++ b/chrome/browser/apps/ephemeral_app_service.cc @@ -194,12 +194,8 @@ void EphemeralAppService::GarbageCollectApps() { GetAppsToRemove(app_count, app_launch_times, &remove_app_ids); for (std::set<std::string>::const_iterator id = remove_app_ids.begin(); id != remove_app_ids.end(); ++id) { - if (service->UninstallExtension( - *id, - ExtensionService::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION, - NULL)) { + if (service->UninstallExtension(*id, false, NULL)) --app_count; - } } } diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc index a8c8179..29ecc8c 100644 --- a/chrome/browser/background/background_application_list_model_unittest.cc +++ b/chrome/browser/background/background_application_list_model_unittest.cc @@ -211,28 +211,23 @@ TEST_F(BackgroundApplicationListModelTest, MAYBE_ExplicitTest) { // Remove in FIFO order. ASSERT_FALSE(IsBackgroundApp(*ext1.get())); - service->UninstallExtension( - ext1->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service->UninstallExtension(ext1->id(), false, 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); + service->UninstallExtension(bgapp1->id(), false, 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); + service->UninstallExtension(ext2->id(), false, 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); + service->UninstallExtension(bgapp2->id(), false, 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); + service->UninstallExtension(ext3->id(), false, NULL); ASSERT_EQ(0U, service->extensions()->size()); ASSERT_EQ(0U, model->size()); } @@ -283,8 +278,7 @@ TEST_F(BackgroundApplicationListModelTest, PushMessagingTest) { ASSERT_EQ(2U, model->size()); // 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); + service->UninstallExtension(ext2->id(), false, NULL); ASSERT_EQ(3U, service->extensions()->size()); ASSERT_EQ(2U, model->size()); ASSERT_TRUE(IsBackgroundApp(*bgapp3.get())); @@ -294,23 +288,19 @@ TEST_F(BackgroundApplicationListModelTest, PushMessagingTest) { // Remove in FIFO order. ASSERT_FALSE(IsBackgroundApp(*ext1.get())); - service->UninstallExtension( - ext1->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service->UninstallExtension(ext1->id(), false, 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); + service->UninstallExtension(bgapp1->id(), false, 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); + service->UninstallExtension(bgapp2->id(), false, 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); + service->UninstallExtension(bgapp3->id(), false, NULL); ASSERT_EQ(0U, service->extensions()->size()); ASSERT_EQ(0U, model->size()); } @@ -427,8 +417,7 @@ void RemoveExtension(ExtensionService* service, extensions->erase(cursor); --*count; ASSERT_EQ(*count, extensions->size()); - service->UninstallExtension( - extension->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service->UninstallExtension(extension->id(), false, NULL); ASSERT_EQ(*count, service->extensions()->size()); ASSERT_EQ(*expected, model->size()); } 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..3919cbe 100644 --- a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc @@ -188,8 +188,7 @@ TEST_F(ActivityLogEnabledTest, WatchdogSwitch) { EXPECT_TRUE(activity_log1->IsDatabaseEnabled()); EXPECT_FALSE(activity_log2->IsDatabaseEnabled()); - extension_service1->UninstallExtension( - kExtensionID, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + extension_service1->UninstallExtension(kExtensionID, false, NULL); EXPECT_EQ(0, profile1->GetPrefs()->GetInteger(prefs::kWatchdogExtensionActive)); @@ -264,8 +263,7 @@ TEST_F(ActivityLogEnabledTest, AppAndCommandLine) { profile->GetPrefs()->GetInteger(prefs::kWatchdogExtensionActive)); EXPECT_TRUE(activity_log->IsWatchdogAppActive()); - extension_service->UninstallExtension( - kExtensionID, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + extension_service->UninstallExtension(kExtensionID, false, NULL); EXPECT_TRUE(activity_log->IsDatabaseEnabled()); EXPECT_EQ(0, diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc index 3e60685..d5805d7 100644 --- a/chrome/browser/extensions/api/management/management_api.cc +++ b/chrome/browser/extensions/api/management/management_api.cc @@ -647,10 +647,10 @@ void ManagementUninstallFunctionBase::Finish(bool should_uninstall) { extension_id_); SendResponse(false); } else { - bool success = service()->UninstallExtension( - extension_id_, - ExtensionService::UNINSTALL_REASON_MANAGEMENT_API, - NULL); + bool success = + service()->UninstallExtension(extension_id_, + false, /* external uninstall */ + NULL); // TODO set error_ if !success SendResponse(success); diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index cdcb71a..3443de8 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -551,8 +551,7 @@ void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) { 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); + service->UninstallExtension(extension_id, false, 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..e2774b6 100644 --- a/chrome/browser/extensions/extension_context_menu_model.cc +++ b/chrome/browser/extensions/extension_context_menu_model.cc @@ -144,11 +144,8 @@ void ExtensionContextMenuModel::ExecuteCommand(int command_id, void ExtensionContextMenuModel::ExtensionUninstallAccepted() { if (GetExtension()) { - extensions::ExtensionSystem::Get(profile_) - ->extension_service() - ->UninstallExtension(extension_id_, - ExtensionService::UNINSTALL_REASON_USER_INITIATED, - NULL); + extensions::ExtensionSystem::Get(profile_)->extension_service()-> + UninstallExtension(extension_id_, false, NULL); } Release(); } diff --git a/chrome/browser/extensions/extension_disabled_ui.cc b/chrome/browser/extensions/extension_disabled_ui.cc index e3b3ea7..b2c8a51 100644 --- a/chrome/browser/extensions/extension_disabled_ui.cc +++ b/chrome/browser/extensions/extension_disabled_ui.cc @@ -365,10 +365,7 @@ bool ExtensionDisabledGlobalError::ShouldCloseOnDeactivate() const { } void ExtensionDisabledGlobalError::ExtensionUninstallAccepted() { - service_->UninstallExtension( - extension_->id(), - ExtensionService::UNINSTALL_REASON_EXTENSION_DISABLED, - NULL); + service_->UninstallExtension(extension_->id(), false, NULL); } void ExtensionDisabledGlobalError::ExtensionUninstallCanceled() { diff --git a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc index ca12a24..43fefca 100644 --- a/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc +++ b/chrome/browser/extensions/extension_gcm_app_handler_unittest.cc @@ -333,8 +333,7 @@ class ExtensionGCMAppHandlerTest : public testing::Test { } void UninstallExtension(const Extension* extension) { - extension_service_->UninstallExtension( - extension->id(), ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + extension_service_->UninstallExtension(extension->id(), false, 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 5f206a0..082d662 100644 --- a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc +++ b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc @@ -720,12 +720,9 @@ TEST_F(ExtensionMessageBubbleTest, MAYBE_SettingsApiControllerTest) { EXPECT_FALSE(prefs->HasSettingsApiBubbleBeenAcknowledged(kId3)); // Clean up after ourselves. - service_->UninstallExtension( - kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); - service_->UninstallExtension( - kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); - service_->UninstallExtension( - kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service_->UninstallExtension(kId1, false, NULL); + service_->UninstallExtension(kId2, false, NULL); + service_->UninstallExtension(kId3, false, NULL); } } @@ -822,12 +819,9 @@ TEST_F(ExtensionMessageBubbleTest, MAYBE_NtpOverriddenControllerTest) { EXPECT_FALSE(prefs->HasNtpOverriddenBubbleBeenAcknowledged(kId3)); // Clean up after ourselves. - service_->UninstallExtension( - kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); - service_->UninstallExtension( - kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); - service_->UninstallExtension( - kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service_->UninstallExtension(kId1, false, NULL); + service_->UninstallExtension(kId2, false, NULL); + service_->UninstallExtension(kId3, false, NULL); } void SetInstallTime(const std::string& extension_id, @@ -945,12 +939,9 @@ TEST_F(ExtensionMessageBubbleTest, MAYBE_ProxyOverriddenControllerTest) { EXPECT_FALSE(prefs->HasProxyOverriddenBubbleBeenAcknowledged(kId3)); // Clean up after ourselves. - service_->UninstallExtension( - kId1, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); - service_->UninstallExtension( - kId2, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); - service_->UninstallExtension( - kId3, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service_->UninstallExtension(kId1, false, NULL); + service_->UninstallExtension(kId2, false, NULL); + service_->UninstallExtension(kId3, false, NULL); } } // namespace extensions diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 3bb1f20..3595b6a 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -168,7 +168,7 @@ void ExtensionService::CheckExternalUninstall(const std::string& id) { << "with id: " << id; return; } - UninstallExtension(id, UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION, NULL); + UninstallExtension(id, true, NULL); } void ExtensionService::SetFileTaskRunnerForTesting( @@ -231,13 +231,13 @@ bool ExtensionService::OnExternalExtensionUpdateUrlFound( } // static -// This function is used to uninstall an extension via sync. The LOG statements -// within this function are used to inform the user if the uninstall cannot be -// done. +// This function is used to implement the command-line switch +// --uninstall-extension, and to uninstall an extension via sync. The LOG +// statements within this function are used to inform the user if the uninstall +// cannot be done. bool ExtensionService::UninstallExtensionHelper( ExtensionService* extensions_service, - const std::string& extension_id, - UninstallReason reason) { + const std::string& extension_id) { // 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 " @@ -248,7 +248,7 @@ bool ExtensionService::UninstallExtensionHelper( // The following call to UninstallExtension will not allow an uninstall of a // policy-controlled extension. base::string16 error; - if (!extensions_service->UninstallExtension(extension_id, reason, &error)) { + if (!extensions_service->UninstallExtension(extension_id, false, &error)) { LOG(WARNING) << "Cannot uninstall extension with id " << extension_id << ": " << error; return false; @@ -694,7 +694,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, + bool external_uninstall, base::string16* error) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -713,9 +713,6 @@ bool ExtensionService::UninstallExtension( // TODO(rdevlin.cronin): This is probably not right. We should do something // else, like include an enum IS_INTERNAL_UNINSTALL or IS_USER_UNINSTALL so // we don't do this. - bool external_uninstall = - (reason == UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION) || - (reason == UNINSTALL_REASON_ORPHANED_SHARED_MODULE); if (!external_uninstall && !system_->management_policy()->UserMayModifySettings( extension.get(), error)) { diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 01c1099..db8611c 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h @@ -155,26 +155,10 @@ 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_INTERNAL_MANAGEMENT, // Internal extensions (see usages) - UNINSTALL_REASON_STORAGE_THRESHOLD_EXCEEDED, - UNINSTALL_REASON_EXTERNAL_INSTALL_CANCELED, - UNINSTALL_REASON_MANAGEMENT_API, - UNINSTALL_REASON_SYNC, - UNINSTALL_REASON_ORPHANED_SHARED_MODULE, - UNINSTALL_REASON_ORPHANED_THEME, - UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION, - UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION - }; - // 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); + const std::string& extension_id); // Constructor stores pointers to |profile| and |extension_prefs| but // ownership remains at caller. @@ -256,10 +240,14 @@ class ExtensionService void ReloadExtension(const std::string& extension_id); // Uninstalls the specified extension. Callers should only call this method - // with extensions that exist. |reason| lets the caller specify why the - // extension is uninstalled. + // with extensions that exist. |external_uninstall| is a magical parameter + // that is only used to send information to ExtensionPrefs, which external + // callers should never set to true. + // + // TODO(aa): Remove |external_uninstall| -- this information should be passed + // to ExtensionPrefs some other way. virtual bool UninstallExtension(const std::string& extension_id, - UninstallReason reason, + bool external_uninstall, 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 0c3f78a..8bec09d 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -857,11 +857,9 @@ class ExtensionServiceTest : public extensions::ExtensionServiceTestBase, // Uninstall it. if (use_helper) { - EXPECT_TRUE(ExtensionService::UninstallExtensionHelper( - service(), id, ExtensionService::UNINSTALL_REASON_FOR_TESTING)); + EXPECT_TRUE(ExtensionService::UninstallExtensionHelper(service(), id)); } else { - EXPECT_TRUE(service()->UninstallExtension( - id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL)); + EXPECT_TRUE(service()->UninstallExtension(id, false, NULL)); } --expected_extensions_count_; @@ -3727,8 +3725,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)); + EXPECT_TRUE(service()->UninstallExtension(extension->id(), false, NULL)); EXPECT_EQ(0u, registry()->enabled_extensions().size()); // Ensure we cannot load it if management policy prohibits installation. @@ -3775,8 +3772,7 @@ TEST_F(ExtensionServiceTest, ManagementPolicyProhibitsUninstall) { GetManagementPolicy()->RegisterProvider(&provider); // Attempt to uninstall it. - EXPECT_FALSE(service()->UninstallExtension( - good_crx, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL)); + EXPECT_FALSE(service()->UninstallExtension(good_crx, false, NULL)); EXPECT_EQ(1u, registry()->enabled_extensions().size()); EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); @@ -4320,8 +4316,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { EXPECT_TRUE(base::DirectoryExists(idb_path)); // Uninstall the extension. - service()->UninstallExtension( - good_crx, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service()->UninstallExtension(good_crx, false, NULL); base::RunLoop().RunUntilIdle(); // Check that the cookie is gone. @@ -4513,8 +4508,7 @@ TEST_F(ExtensionServiceTest, DISABLED_LoadExtension) { // Test uninstall. std::string id = loaded_[0]->id(); EXPECT_FALSE(unloaded_id_.length()); - service()->UninstallExtension( - id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service()->UninstallExtension(id, false, NULL); base::RunLoop().RunUntilIdle(); EXPECT_EQ(id, unloaded_id_); ASSERT_EQ(0u, loaded_.size()); @@ -4626,8 +4620,7 @@ void ExtensionServiceTest::TestExternalProvider( std::string id = loaded_[0]->id(); bool no_uninstall = GetManagementPolicy()->MustRemainEnabled(loaded_[0].get(), NULL); - service()->UninstallExtension( - id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service()->UninstallExtension(id, false, NULL); base::RunLoop().RunUntilIdle(); base::FilePath install_path = extensions_install_dir().AppendASCII(id); @@ -4691,8 +4684,7 @@ void ExtensionServiceTest::TestExternalProvider( // User uninstalls. loaded_.clear(); - service()->UninstallExtension( - id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service()->UninstallExtension(id, false, 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..750caaa 100644 --- a/chrome/browser/extensions/extension_storage_monitor.cc +++ b/chrome/browser/extensions/extension_storage_monitor.cc @@ -319,10 +319,7 @@ void ExtensionStorageMonitor::ExtensionUninstallAccepted() { ExtensionService* service = ExtensionSystem::Get(context_)->extension_service(); DCHECK(service); - service->UninstallExtension( - extension->id(), - ExtensionService::UNINSTALL_REASON_STORAGE_THRESHOLD_EXCEEDED, - NULL); + service->UninstallExtension(extension->id(), false, NULL); } void ExtensionStorageMonitor::ExtensionUninstallCanceled() { diff --git a/chrome/browser/extensions/extension_sync_service.cc b/chrome/browser/extensions/extension_sync_service.cc index e1b1af2..b125e72 100644 --- a/chrome/browser/extensions/extension_sync_service.cc +++ b/chrome/browser/extensions/extension_sync_service.cc @@ -449,8 +449,7 @@ bool ExtensionSyncService::ProcessExtensionSyncDataHelper( // Handle uninstalls first. if (extension_sync_data.uninstalled()) { - if (!extension_service_->UninstallExtensionHelper( - extension_service_, id, ExtensionService::UNINSTALL_REASON_SYNC)) { + if (!extension_service_->UninstallExtensionHelper(extension_service_, id)) { LOG(WARNING) << "Could not uninstall extension " << id << " for sync"; } diff --git a/chrome/browser/extensions/external_install_error.cc b/chrome/browser/extensions/external_install_error.cc index 5937350..a08a40c 100644 --- a/chrome/browser/extensions/external_install_error.cc +++ b/chrome/browser/extensions/external_install_error.cc @@ -284,10 +284,9 @@ void ExternalInstallError::InstallUIAbort(bool user_initiated) { if (user_initiated && GetExtension()) { ExtensionSystem::Get(browser_context_) ->extension_service() - ->UninstallExtension( - extension_id_, - ExtensionService::UNINSTALL_REASON_EXTERNAL_INSTALL_CANCELED, - NULL); // Ignore error. + ->UninstallExtension(extension_id_, + false, // Not externally uninstalled. + 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/shared_module_service.cc b/chrome/browser/extensions/shared_module_service.cc index 8474d24..05d2804 100644 --- a/chrome/browser/extensions/shared_module_service.cc +++ b/chrome/browser/extensions/shared_module_service.cc @@ -152,10 +152,9 @@ void SharedModuleService::OnExtensionUninstalled( scoped_ptr<ExtensionSet> dependents = GetDependentExtensions(imported_module); if (dependents->is_empty()) { - service->UninstallExtension( - iter->extension_id, - ExtensionService::UNINSTALL_REASON_ORPHANED_SHARED_MODULE, - NULL); // Ignore error. + service->UninstallExtension(iter->extension_id, + true, // External uninstall. + NULL); // Ignore error. } } } diff --git a/chrome/browser/extensions/shared_module_service_unittest.cc b/chrome/browser/extensions/shared_module_service_unittest.cc index 8dd520d..2c38444 100644 --- a/chrome/browser/extensions/shared_module_service_unittest.cc +++ b/chrome/browser/extensions/shared_module_service_unittest.cc @@ -131,7 +131,7 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUninstall) { // Uninstall the extension that imports our module. base::string16 error; service_->UninstallExtension(importing_extension->id(), - ExtensionService::UNINSTALL_REASON_FOR_TESTING, + false, // Not external uninstall. &error); EXPECT_TRUE(error.empty()); diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index d1c7bb7..12e95d2 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -705,8 +705,7 @@ class PolicyTest : public InProcessBrowserTest { expect_success ? chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED : chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, content::NotificationService::AllSources()); - extension_service()->UninstallExtension( - id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + extension_service()->UninstallExtension(id, false, NULL); observer.Wait(); } diff --git a/chrome/browser/search/hotword_service.cc b/chrome/browser/search/hotword_service.cc index f395fd9..f7f8aed 100644 --- a/chrome/browser/search/hotword_service.cc +++ b/chrome/browser/search/hotword_service.cc @@ -360,9 +360,7 @@ bool HotwordService::UninstallHotwordExtension( ExtensionService* extension_service) { base::string16 error; if (!extension_service->UninstallExtension( - extension_misc::kHotwordExtensionId, - ExtensionService::UNINSTALL_REASON_INTERNAL_MANAGEMENT, - &error)) { + extension_misc::kHotwordExtensionId, true, &error)) { LOG(WARNING) << "Cannot uninstall extension with id " << extension_misc::kHotwordExtensionId << ": " << error; diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index 7f51c71..6ff3938 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -82,8 +82,7 @@ void SyncExtensionHelper::UninstallExtension( Profile* profile, const std::string& name) { ExtensionService::UninstallExtensionHelper( extensions::ExtensionSystem::Get(profile)->extension_service(), - extensions::id_util::GenerateId(name), - ExtensionService::UNINSTALL_REASON_SYNC); + extensions::id_util::GenerateId(name)); } std::vector<std::string> SyncExtensionHelper::GetInstalledExtensionNames( diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 5d4f0b3..618eeb2 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -366,12 +366,8 @@ void ThemeService::RemoveUnusedThemes(bool ignore_infobars) { // are installed but not loaded because they are blacklisted by a management // policy provider. - for (size_t i = 0; i < remove_list.size(); ++i) { - service->UninstallExtension( - remove_list[i], - ExtensionService::UNINSTALL_REASON_ORPHANED_THEME, - NULL); - } + for (size_t i = 0; i < remove_list.size(); ++i) + service->UninstallExtension(remove_list[i], false, NULL); } void ThemeService::UseDefaultTheme() { diff --git a/chrome/browser/themes/theme_service_unittest.cc b/chrome/browser/themes/theme_service_unittest.cc index 45f82e4..85bf126 100644 --- a/chrome/browser/themes/theme_service_unittest.cc +++ b/chrome/browser/themes/theme_service_unittest.cc @@ -119,8 +119,7 @@ TEST_F(ThemeServiceTest, ThemeInstallUninstall) { EXPECT_EQ(extension_id, theme_service->GetThemeID()); // Now uninstall the extension, should revert to the default theme. - service_->UninstallExtension( - extension_id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service_->UninstallExtension(extension_id, false, 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 4bf3ebd..1f04c25 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.cc +++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc @@ -116,8 +116,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, false, NULL); } bool GetAppListItemType(AppListItem* item, 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 ae70cbb..fb23569 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 @@ -196,8 +196,7 @@ TEST_F(ExtensionAppModelBuilderTest, DisableAndEnable) { } TEST_F(ExtensionAppModelBuilderTest, Uninstall) { - service_->UninstallExtension( - kPackagedApp2Id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service_->UninstallExtension(kPackagedApp2Id, false, NULL); EXPECT_EQ(std::string("Packaged App 1,Hosted App"), GetModelContent(model_.get())); @@ -212,8 +211,7 @@ TEST_F(ExtensionAppModelBuilderTest, UninstallTerminatedApp) { // Simulate an app termination. service_->TrackTerminatedExtensionForTest(app); - service_->UninstallExtension( - kPackagedApp2Id, ExtensionService::UNINSTALL_REASON_FOR_TESTING, NULL); + service_->UninstallExtension(kPackagedApp2Id, false, 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..a60a744 100644 --- a/chrome/browser/ui/app_list/extension_uninstaller.cc +++ b/chrome/browser/ui/app_list/extension_uninstaller.cc @@ -42,8 +42,9 @@ void ExtensionUninstaller::ExtensionUninstallAccepted() { const extensions::Extension* extension = service->GetInstalledExtension(app_id_); if (extension) { - service->UninstallExtension( - app_id_, ExtensionService::UNINSTALL_REASON_USER_INITIATED, NULL); + service->UninstallExtension(app_id_, + false, /* external_uninstall*/ + NULL); } controller_->OnCloseChildDialog(); CleanUp(); 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..f3d5582 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 @@ -84,8 +84,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); + service_->UninstallExtension(kPackagedApp1Id, false, 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 a4bb7b2..a33a737 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -1307,9 +1307,7 @@ 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(), false, 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..21daa37 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 @@ -147,10 +147,7 @@ IN_PROC_BROWSER_TEST_F(AppShimMenuControllerBrowserTest, object:app_1_app_window->GetNativeWindow()]; CheckHasAppMenus(app_1_); - ExtensionService::UninstallExtensionHelper( - extension_service(), - app_1_->id(), - ExtensionService::UNINSTALL_REASON_FOR_TESTING); + ExtensionService::UninstallExtensionHelper(extension_service(), app_1_->id()); 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..9824eae 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 @@ -52,11 +52,8 @@ class AsyncUninstaller : public extensions::ExtensionUninstallDialog::Delegate { // ExtensionUninstallDialog::Delegate: virtual void ExtensionUninstallAccepted() OVERRIDE { - extensions::ExtensionSystem::Get(profile_) - ->extension_service() - ->UninstallExtension(extension_->id(), - ExtensionService::UNINSTALL_REASON_USER_INITIATED, - NULL); + extensions::ExtensionSystem::Get(profile_)->extension_service()-> + UninstallExtension(extension_->id(), false, NULL); } virtual void ExtensionUninstallCanceled() 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..b9a511b 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 @@ -114,8 +114,7 @@ void AppInfoFooterPanel::ButtonPressed(views::Button* sender, void AppInfoFooterPanel::ExtensionUninstallAccepted() { ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->extension_service(); - service->UninstallExtension( - app_->id(), ExtensionService::UNINSTALL_REASON_USER_INITIATED, NULL); + service->UninstallExtension(app_->id(), false, 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 59e454b..e1a66c8 100644 --- a/chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc +++ b/chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc @@ -207,9 +207,7 @@ void BookmarkAppBubbleView::WindowClosing() { if (remove_app_) { GetExtensionService(profile_)->UninstallExtension( - extension_id_, - ExtensionService::UNINSTALL_REASON_INTERNAL_MANAGEMENT, - NULL); + extension_id_, false, 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 a8d4531..caa685f 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -735,10 +735,9 @@ void ExtensionSettingsHandler::ExtensionUninstallAccepted() { if (!extension) return; - extension_service_->UninstallExtension( - extension_id_prompting_, - ExtensionService::UNINSTALL_REASON_USER_INITIATED, - NULL); // Error. + extension_service_->UninstallExtension(extension_id_prompting_, + false, // External uninstall. + NULL); // Error. extension_id_prompting_ = ""; // There will be no EXTENSION_UNLOADED notification for terminated diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 33c5196..5f5fe6b 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -794,10 +794,8 @@ void AppLauncherHandler::ExtensionUninstallAccepted() { if (!extension) return; - extension_service_->UninstallExtension( - extension_id_prompting_, - ExtensionService::UNINSTALL_REASON_USER_INITIATED, - NULL); + extension_service_->UninstallExtension(extension_id_prompting_, + false /* external_uninstall */, NULL); CleanupAfterUninstall(); } |