summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 18:31:01 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-05 18:31:01 +0000
commit79c833b5768e45043ede28603919323bef4db6b8 (patch)
treef2bcffbb31216a026eb4b9653c61810780db797d /chrome/browser/extensions
parent4e963b73e6be8d0b6676cf014bc9363863130ea6 (diff)
downloadchromium_src-79c833b5768e45043ede28603919323bef4db6b8.zip
chromium_src-79c833b5768e45043ede28603919323bef4db6b8.tar.gz
chromium_src-79c833b5768e45043ede28603919323bef4db6b8.tar.bz2
Rename Extension::KILLBIT to EXTERNAL_EXTENSION_UNINSTALLED.
It would be good to also rename "external extension" to something else, but this is a quick improvement. TBR=mpcomplete@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80493 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_management_browsertest.cc8
-rw-r--r--chrome/browser/extensions/extension_prefs.cc10
-rw-r--r--chrome/browser/extensions/extension_prefs.h6
-rw-r--r--chrome/browser/extensions/extension_service.cc2
-rw-r--r--chrome/browser/extensions/extension_service_unittest.cc16
-rw-r--r--chrome/browser/extensions/pending_extension_manager.cc2
6 files changed, 25 insertions, 19 deletions
diff --git a/chrome/browser/extensions/extension_management_browsertest.cc b/chrome/browser/extensions/extension_management_browsertest.cc
index 4d0e385..8666631 100644
--- a/chrome/browser/extensions/extension_management_browsertest.cc
+++ b/chrome/browser/extensions/extension_management_browsertest.cc
@@ -373,7 +373,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) {
UninstallExtension(kExtensionId);
ExtensionPrefs* extension_prefs = service->extension_prefs();
- EXPECT_TRUE(extension_prefs->IsExtensionKilled(kExtensionId))
+ EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
<< "Uninstalling should set kill bit on externaly installed extension.";
// Try to install the extension again from an external source. It should fail
@@ -383,19 +383,19 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) {
Extension::EXTERNAL_PREF_DOWNLOAD);
EXPECT_FALSE(pending_extension_manager->IsIdPending(kExtensionId))
<< "External reinstall of a killed extension shouldn't work.";
- EXPECT_TRUE(extension_prefs->IsExtensionKilled(kExtensionId))
+ EXPECT_TRUE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
<< "External reinstall of a killed extension should leave it killed.";
// Installing from non-external source.
ASSERT_TRUE(InstallExtension(basedir.AppendASCII("v2.crx"), 1));
- EXPECT_FALSE(extension_prefs->IsExtensionKilled(kExtensionId))
+ EXPECT_FALSE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
<< "Reinstalling should clear the kill bit.";
// Uninstalling from a non-external source should not set the kill bit.
UninstallExtension(kExtensionId);
- EXPECT_FALSE(extension_prefs->IsExtensionKilled(kExtensionId))
+ EXPECT_FALSE(extension_prefs->IsExternalExtensionUninstalled(kExtensionId))
<< "Uninstalling non-external extension should not set kill bit.";
}
diff --git a/chrome/browser/extensions/extension_prefs.cc b/chrome/browser/extensions/extension_prefs.cc
index 38d0015..38b68bc 100644
--- a/chrome/browser/extensions/extension_prefs.cc
+++ b/chrome/browser/extensions/extension_prefs.cc
@@ -765,13 +765,14 @@ void ExtensionPrefs::SetLaunchType(const std::string& extension_id,
SavePrefsAndNotify();
}
-bool ExtensionPrefs::IsExtensionKilled(const std::string& id) const {
+bool ExtensionPrefs::IsExternalExtensionUninstalled(
+ const std::string& id) const {
DictionaryValue* extension = GetExtensionPref(id);
if (!extension)
return false;
int state = 0;
return extension->GetInteger(kPrefState, &state) &&
- state == static_cast<int>(Extension::KILLBIT);
+ state == static_cast<int>(Extension::EXTERNAL_EXTENSION_UNINSTALLED);
}
std::vector<std::string> ExtensionPrefs::GetToolbarOrder() {
@@ -839,7 +840,8 @@ void ExtensionPrefs::OnExtensionUninstalled(const std::string& extension_id,
// no longer lists the extension).
if (!external_uninstall && Extension::IsExternalLocation(location)) {
UpdateExtensionPref(extension_id, kPrefState,
- Value::CreateIntegerValue(Extension::KILLBIT));
+ Value::CreateIntegerValue(
+ Extension::EXTERNAL_EXTENSION_UNINSTALLED));
SavePrefsAndNotify();
extension_pref_value_map_->SetExtensionState(extension_id, false);
} else {
@@ -1004,7 +1006,7 @@ static ExtensionInfo* GetInstalledExtensionInfoImpl(
// extensions.
return NULL;
}
- if (state_value == Extension::KILLBIT) {
+ if (state_value == Extension::EXTERNAL_EXTENSION_UNINSTALLED) {
LOG(WARNING) << "External extension with id " << *extension_id
<< " has been uninstalled by the user";
return NULL;
diff --git a/chrome/browser/extensions/extension_prefs.h b/chrome/browser/extensions/extension_prefs.h
index a1f08f2..980ef70 100644
--- a/chrome/browser/extensions/extension_prefs.h
+++ b/chrome/browser/extensions/extension_prefs.h
@@ -75,9 +75,9 @@ class ExtensionPrefs {
// aware of the internal structure of the preferences.
DictionaryValue* CopyCurrentExtensions();
- // Returns true if the specified extension has an entry in prefs
- // and its killbit is on.
- bool IsExtensionKilled(const std::string& id) const;
+ // Returns true if the specified external extension was uninstalled by the
+ // user.
+ bool IsExternalExtensionUninstalled(const std::string& id) const;
// Get the order that toolstrip URLs appear in the shelf.
typedef std::vector<GURL> URLList;
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 03b1fda..57d3c13 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1669,7 +1669,7 @@ void ExtensionService::OnExternalExtensionFileFound(
Extension::Location location) {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
CHECK(Extension::IdIsValid(id));
- if (extension_prefs_->IsExtensionKilled(id))
+ if (extension_prefs_->IsExternalExtensionUninstalled(id))
return;
DCHECK(version);
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index 0bfa658..b3d1028 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -1108,8 +1108,8 @@ TEST_F(ExtensionServiceTest, InstallExtension) {
// TODO(erikkay): add tests for upgrade cases.
}
-// Test the handling of killed extensions.
-TEST_F(ExtensionServiceTest, KilledExtensions) {
+// Test the handling of Extension::EXTERNAL_EXTENSION_UNINSTALLED
+TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) {
InitializeEmptyExtensionService();
FilePath extensions_path;
@@ -1129,14 +1129,16 @@ TEST_F(ExtensionServiceTest, KilledExtensions) {
// Uninstall it and check that its killbit gets set.
service_->UninstallExtension(good_crx, false);
loop_.RunAllPending();
- ValidateIntegerPref(good_crx, "location", Extension::KILLBIT);
+ ValidateIntegerPref(good_crx, "location",
+ Extension::EXTERNAL_EXTENSION_UNINSTALLED);
// Try to re-install it externally. This should fail because of the killbit.
service_->OnExternalExtensionFileFound(good_crx, version.get(),
path, Extension::EXTERNAL_PREF);
loop_.RunAllPending();
ASSERT_TRUE(NULL == service_->GetExtensionById(good_crx, false));
- ValidateIntegerPref(good_crx, "location", Extension::KILLBIT);
+ ValidateIntegerPref(good_crx, "location",
+ Extension::EXTERNAL_EXTENSION_UNINSTALLED);
version.reset(Version::GetVersionFromString("1.0.0.1"));
// Repeat the same thing with a newer version of the extension.
@@ -1145,7 +1147,8 @@ TEST_F(ExtensionServiceTest, KilledExtensions) {
path, Extension::EXTERNAL_PREF);
loop_.RunAllPending();
ASSERT_TRUE(NULL == service_->GetExtensionById(good_crx, false));
- ValidateIntegerPref(good_crx, "location", Extension::KILLBIT);
+ ValidateIntegerPref(good_crx, "location",
+ Extension::EXTERNAL_EXTENSION_UNINSTALLED);
// Try adding the same extension from an external update URL.
service_->pending_extension_manager()->AddFromExternalUpdateUrl(
@@ -2975,7 +2978,8 @@ void ExtensionServiceTest::TestExternalProvider(
loop_.RunAllPending();
ASSERT_EQ(0u, loaded_.size());
ValidatePrefKeyCount(1);
- ValidateIntegerPref(good_crx, "state", Extension::KILLBIT);
+ ValidateIntegerPref(good_crx, "state",
+ Extension::EXTERNAL_EXTENSION_UNINSTALLED);
ValidateIntegerPref(good_crx, "location", location);
// Now clear the preference and reinstall.
diff --git a/chrome/browser/extensions/pending_extension_manager.cc b/chrome/browser/extensions/pending_extension_manager.cc
index 313cd482..268df59 100644
--- a/chrome/browser/extensions/pending_extension_manager.cc
+++ b/chrome/browser/extensions/pending_extension_manager.cc
@@ -81,7 +81,7 @@ void PendingExtensionManager::AddFromExternalUpdateUrl(
const bool kEnableOnInstall = true;
const bool kEnableIncognitoOnInstall = false;
- if (service_.const_extension_prefs().IsExtensionKilled(id))
+ if (service_.const_extension_prefs().IsExternalExtensionUninstalled(id))
return;
if (service_.GetExtensionById(id, true)) {