Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: extensions/browser/extension_prefs.cc

Issue 1136543003: Extensions: Store disable reasons in Sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index 99955f497148007721915b68ac84dab01456e739..460e0de7297f1e97470323c7a97f2e69406a2f5d 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -539,7 +539,7 @@ bool ExtensionPrefs::HasPrefForExtension(
bool ExtensionPrefs::ReadPrefAsURLPatternSet(const std::string& extension_id,
const std::string& pref_key,
URLPatternSet* result,
- int valid_schemes) {
+ int valid_schemes) const {
const base::ListValue* value = NULL;
if (!ReadPrefAsList(extension_id, pref_key, &value))
return false;
@@ -572,7 +572,7 @@ bool ExtensionPrefs::ReadPrefAsBooleanAndReturn(
PermissionSet* ExtensionPrefs::ReadPrefAsPermissionSet(
const std::string& extension_id,
- const std::string& pref_key) {
+ const std::string& pref_key) const {
if (!GetExtensionPref(extension_id))
return NULL;
@@ -682,7 +682,7 @@ int ExtensionPrefs::IncrementAcknowledgePromptCount(
}
bool ExtensionPrefs::IsExternalExtensionAcknowledged(
- const std::string& extension_id) {
+ const std::string& extension_id) const {
return ReadPrefAsBooleanAndReturn(extension_id, kPrefExternalAcknowledged);
}
@@ -695,7 +695,7 @@ void ExtensionPrefs::AcknowledgeExternalExtension(
}
bool ExtensionPrefs::IsBlacklistedExtensionAcknowledged(
- const std::string& extension_id) {
+ const std::string& extension_id) const {
return ReadPrefAsBooleanAndReturn(extension_id, kPrefBlacklistAcknowledged);
}
@@ -708,7 +708,7 @@ void ExtensionPrefs::AcknowledgeBlacklistedExtension(
}
bool ExtensionPrefs::IsExternalInstallFirstRun(
- const std::string& extension_id) {
+ const std::string& extension_id) const {
return ReadPrefAsBooleanAndReturn(extension_id, kPrefExternalInstallFirstRun);
}
@@ -728,7 +728,7 @@ bool ExtensionPrefs::SetAlertSystemFirstRun() {
}
bool ExtensionPrefs::DidExtensionEscalatePermissions(
- const std::string& extension_id) {
+ const std::string& extension_id) const {
return ReadPrefAsBooleanAndReturn(extension_id,
kExtensionDidEscalatePermissions);
}
@@ -759,6 +759,11 @@ void ExtensionPrefs::AddDisableReason(const std::string& extension_id,
ModifyDisableReasons(extension_id, disable_reason, DISABLE_REASON_ADD);
}
+void ExtensionPrefs::AddDisableReasons(const std::string& extension_id,
+ int disable_reasons) {
+ ModifyDisableReasons(extension_id, disable_reasons, DISABLE_REASON_ADD);
+}
+
void ExtensionPrefs::RemoveDisableReason(
const std::string& extension_id,
Extension::DisableReason disable_reason) {
@@ -803,7 +808,7 @@ void ExtensionPrefs::ModifyDisableReasons(const std::string& extension_id,
OnExtensionDisableReasonsChanged(extension_id, new_value));
}
-std::set<std::string> ExtensionPrefs::GetBlacklistedExtensions() {
+std::set<std::string> ExtensionPrefs::GetBlacklistedExtensions() const {
std::set<std::string> ids;
const base::DictionaryValue* extensions =
@@ -921,7 +926,8 @@ void ExtensionPrefs::SetBlacklistLastPingDay(const base::Time& time) {
SaveTime(update.Get(), kLastPingDay, time);
}
-base::Time ExtensionPrefs::LastActivePingDay(const std::string& extension_id) {
+base::Time ExtensionPrefs::LastActivePingDay(
+ const std::string& extension_id) const {
DCHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadTime(GetExtensionPref(extension_id), kLastActivePingDay);
}
@@ -933,7 +939,7 @@ void ExtensionPrefs::SetLastActivePingDay(const std::string& extension_id,
SaveTime(update.Get(), kLastActivePingDay, time);
}
-bool ExtensionPrefs::GetActiveBit(const std::string& extension_id) {
+bool ExtensionPrefs::GetActiveBit(const std::string& extension_id) const {
const base::DictionaryValue* dictionary = GetExtensionPref(extension_id);
bool result = false;
if (dictionary && dictionary->GetBoolean(kActiveBit, &result))
@@ -1026,7 +1032,7 @@ void ExtensionPrefs::MigrateDisableReasons(
}
PermissionSet* ExtensionPrefs::GetGrantedPermissions(
- const std::string& extension_id) {
+ const std::string& extension_id) const {
CHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadPrefAsPermissionSet(extension_id, kPrefGrantedPermissions);
}
@@ -1068,7 +1074,7 @@ void ExtensionPrefs::RemoveGrantedPermissions(
}
PermissionSet* ExtensionPrefs::GetActivePermissions(
- const std::string& extension_id) {
+ const std::string& extension_id) const {
CHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadPrefAsPermissionSet(extension_id, kPrefActivePermissions);
}
@@ -1086,7 +1092,7 @@ void ExtensionPrefs::SetExtensionRunning(const std::string& extension_id,
UpdateExtensionPref(extension_id, kPrefRunning, value);
}
-bool ExtensionPrefs::IsExtensionRunning(const std::string& extension_id) {
+bool ExtensionPrefs::IsExtensionRunning(const std::string& extension_id) const {
const base::DictionaryValue* extension = GetExtensionPref(extension_id);
if (!extension)
return false;
@@ -1101,7 +1107,7 @@ void ExtensionPrefs::SetIsActive(const std::string& extension_id,
UpdateExtensionPref(extension_id, kIsActive, value);
}
-bool ExtensionPrefs::IsActive(const std::string& extension_id) {
+bool ExtensionPrefs::IsActive(const std::string& extension_id) const {
const base::DictionaryValue* extension = GetExtensionPref(extension_id);
if (!extension)
return false;
@@ -1162,7 +1168,7 @@ bool ExtensionPrefs::IsExtensionDisabled(
return DoesExtensionHaveState(id, Extension::DISABLED);
}
-ExtensionIdList ExtensionPrefs::GetToolbarOrder() {
+ExtensionIdList ExtensionPrefs::GetToolbarOrder() const {
ExtensionIdList id_list_out;
GetUserExtensionPrefIntoContainer(pref_names::kToolbar, &id_list_out);
return id_list_out;
@@ -1238,7 +1244,7 @@ void ExtensionPrefs::SetExtensionBlacklistState(const std::string& extension_id,
}
BlacklistState ExtensionPrefs::GetExtensionBlacklistState(
- const std::string& extension_id) {
+ const std::string& extension_id) const {
if (IsExtensionBlacklisted(extension_id))
return BLACKLISTED_MALWARE;
const base::DictionaryValue* ext_prefs = GetExtensionPref(extension_id);
@@ -1249,7 +1255,8 @@ BlacklistState ExtensionPrefs::GetExtensionBlacklistState(
return NOT_BLACKLISTED;
}
-std::string ExtensionPrefs::GetVersionString(const std::string& extension_id) {
+std::string ExtensionPrefs::GetVersionString(
+ const std::string& extension_id) const {
const base::DictionaryValue* extension = GetExtensionPref(extension_id);
if (!extension)
return std::string();
@@ -1546,7 +1553,8 @@ void ExtensionPrefs::OnEphemeralAppPromoted(const std::string& extension_id) {
}
}
-bool ExtensionPrefs::WasAppDraggedByUser(const std::string& extension_id) {
+bool ExtensionPrefs::WasAppDraggedByUser(
+ const std::string& extension_id) const {
return ReadPrefAsBooleanAndReturn(extension_id, kPrefUserDraggedApp);
}
@@ -1684,7 +1692,7 @@ void ExtensionPrefs::ClearLastLaunchTimes() {
}
}
-void ExtensionPrefs::GetExtensions(ExtensionIdList* out) {
+void ExtensionPrefs::GetExtensions(ExtensionIdList* out) const {
CHECK(out);
scoped_ptr<ExtensionsInfo> extensions_info(GetInstalledExtensionsInfo());
@@ -1783,7 +1791,7 @@ void ExtensionPrefs::InitPrefStore() {
extension_pref_value_map_->NotifyInitializationCompleted();
}
-bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) {
+bool ExtensionPrefs::HasIncognitoPrefValue(const std::string& pref_key) const {
bool has_incognito_pref_value = false;
extension_pref_value_map_->GetEffectivePrefValue(pref_key,
true,
@@ -1810,7 +1818,7 @@ void ExtensionPrefs::SetGeometryCache(
UpdateExtensionPref(extension_id, kPrefGeometryCache, cache.release());
}
-const base::DictionaryValue* ExtensionPrefs::GetInstallSignature() {
+const base::DictionaryValue* ExtensionPrefs::GetInstallSignature() const {
return prefs_->GetDictionary(kInstallSignature);
}
@@ -1843,7 +1851,7 @@ void ExtensionPrefs::SetInstallParam(const std::string& extension_id,
new base::StringValue(install_parameter));
}
-int ExtensionPrefs::GetCorruptedDisableCount() {
+int ExtensionPrefs::GetCorruptedDisableCount() const {
return prefs_->GetInteger(kCorruptedDisableCount);
}
@@ -1888,7 +1896,7 @@ void ExtensionPrefs::SetNeedsStorageGarbageCollection(bool value) {
prefs_->SetBoolean(pref_names::kStorageGarbageCollect, value);
}
-bool ExtensionPrefs::NeedsStorageGarbageCollection() {
+bool ExtensionPrefs::NeedsStorageGarbageCollection() const {
return prefs_->GetBoolean(pref_names::kStorageGarbageCollect);
}
@@ -1925,7 +1933,7 @@ void ExtensionPrefs::RegisterProfilePrefs(
template <class ExtensionIdContainer>
bool ExtensionPrefs::GetUserExtensionPrefIntoContainer(
const char* pref,
- ExtensionIdContainer* id_container_out) {
+ ExtensionIdContainer* id_container_out) const {
DCHECK(id_container_out->empty());
const base::Value* user_pref_value = prefs_->GetUserPrefValue(pref);
@@ -1966,7 +1974,7 @@ void ExtensionPrefs::PopulateExtensionInfoPrefs(
Extension::State initial_state,
int install_flags,
const std::string& install_parameter,
- base::DictionaryValue* extension_dict) {
+ base::DictionaryValue* extension_dict) const {
extension_dict->Set(kPrefState, new base::FundamentalValue(initial_state));
extension_dict->Set(kPrefLocation,
new base::FundamentalValue(extension->location()));

Powered by Google App Engine
This is Rietveld 408576698