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

Unified Diff: extensions/browser/extension_prefs.cc

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 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
« no previous file with comments | « extensions/browser/extension_message_filter.cc ('k') | extensions/browser/external_provider_interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_prefs.cc
diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc
index d7774c56689aa4ae76b1b56b6bb90723b3a26166..aa7fd59907eb302d40935eba1880fff72527a147 100644
--- a/extensions/browser/extension_prefs.cc
+++ b/extensions/browser/extension_prefs.cc
@@ -12,6 +12,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/value_conversions.h"
+#include "components/crx_file/id_util.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "extensions/browser/admin_policy.h"
#include "extensions/browser/app_sorting.h"
@@ -287,7 +288,7 @@ ExtensionPrefs::ScopedUpdate<T, type_enum_value>::ScopedUpdate(
: update_(prefs->pref_service(), pref_names::kExtensions),
extension_id_(extension_id),
key_(key) {
- DCHECK(Extension::IdIsValid(extension_id_));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id_));
}
template <typename T, base::Value::Type type_enum_value>
@@ -456,7 +457,7 @@ const base::DictionaryValue* ExtensionPrefs::GetExtensionPref(
void ExtensionPrefs::UpdateExtensionPref(const std::string& extension_id,
const std::string& key,
base::Value* data_value) {
- if (!Extension::IdIsValid(extension_id)) {
+ if (!crx_file::id_util::IdIsValid(extension_id)) {
NOTREACHED() << "Invalid extension_id " << extension_id;
return;
}
@@ -683,7 +684,7 @@ bool ExtensionPrefs::IsExternalExtensionAcknowledged(
void ExtensionPrefs::AcknowledgeExternalExtension(
const std::string& extension_id) {
- DCHECK(Extension::IdIsValid(extension_id));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id));
UpdateExtensionPref(extension_id, kPrefExternalAcknowledged,
new base::FundamentalValue(true));
UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount, NULL);
@@ -696,7 +697,7 @@ bool ExtensionPrefs::IsBlacklistedExtensionAcknowledged(
void ExtensionPrefs::AcknowledgeBlacklistedExtension(
const std::string& extension_id) {
- DCHECK(Extension::IdIsValid(extension_id));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id));
UpdateExtensionPref(extension_id, kPrefBlacklistAcknowledged,
new base::FundamentalValue(true));
UpdateExtensionPref(extension_id, kPrefAcknowledgePromptCount, NULL);
@@ -709,7 +710,7 @@ bool ExtensionPrefs::IsExternalInstallFirstRun(
void ExtensionPrefs::SetExternalInstallFirstRun(
const std::string& extension_id) {
- DCHECK(Extension::IdIsValid(extension_id));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id));
UpdateExtensionPref(extension_id, kPrefExternalInstallFirstRun,
new base::FundamentalValue(true));
}
@@ -953,13 +954,13 @@ base::Time ReadTime(const base::DictionaryValue* dictionary, const char* key) {
} // namespace
base::Time ExtensionPrefs::LastPingDay(const std::string& extension_id) const {
- DCHECK(Extension::IdIsValid(extension_id));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadTime(GetExtensionPref(extension_id), kLastPingDay);
}
void ExtensionPrefs::SetLastPingDay(const std::string& extension_id,
const base::Time& time) {
- DCHECK(Extension::IdIsValid(extension_id));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id));
ScopedExtensionPrefUpdate update(prefs_, extension_id);
SaveTime(update.Get(), kLastPingDay, time);
}
@@ -975,13 +976,13 @@ void ExtensionPrefs::SetBlacklistLastPingDay(const base::Time& time) {
}
base::Time ExtensionPrefs::LastActivePingDay(const std::string& extension_id) {
- DCHECK(Extension::IdIsValid(extension_id));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadTime(GetExtensionPref(extension_id), kLastActivePingDay);
}
void ExtensionPrefs::SetLastActivePingDay(const std::string& extension_id,
const base::Time& time) {
- DCHECK(Extension::IdIsValid(extension_id));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id));
ScopedExtensionPrefUpdate update(prefs_, extension_id);
SaveTime(update.Get(), kLastActivePingDay, time);
}
@@ -1080,14 +1081,14 @@ void ExtensionPrefs::MigrateDisableReasons(
PermissionSet* ExtensionPrefs::GetGrantedPermissions(
const std::string& extension_id) {
- CHECK(Extension::IdIsValid(extension_id));
+ CHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadPrefAsPermissionSet(extension_id, kPrefGrantedPermissions);
}
void ExtensionPrefs::AddGrantedPermissions(
const std::string& extension_id,
const PermissionSet* permissions) {
- CHECK(Extension::IdIsValid(extension_id));
+ CHECK(crx_file::id_util::IdIsValid(extension_id));
scoped_refptr<PermissionSet> granted_permissions(
GetGrantedPermissions(extension_id));
@@ -1105,7 +1106,7 @@ void ExtensionPrefs::AddGrantedPermissions(
void ExtensionPrefs::RemoveGrantedPermissions(
const std::string& extension_id,
const PermissionSet* permissions) {
- CHECK(Extension::IdIsValid(extension_id));
+ CHECK(crx_file::id_util::IdIsValid(extension_id));
scoped_refptr<PermissionSet> granted_permissions(
GetGrantedPermissions(extension_id));
@@ -1122,7 +1123,7 @@ void ExtensionPrefs::RemoveGrantedPermissions(
PermissionSet* ExtensionPrefs::GetActivePermissions(
const std::string& extension_id) {
- CHECK(Extension::IdIsValid(extension_id));
+ CHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadPrefAsPermissionSet(extension_id, kPrefActivePermissions);
}
@@ -1401,7 +1402,7 @@ ExtensionPrefs::GetInstalledExtensionsInfo() const {
prefs_->GetDictionary(pref_names::kExtensions);
for (base::DictionaryValue::Iterator extension_id(*extensions);
!extension_id.IsAtEnd(); extension_id.Advance()) {
- if (!Extension::IdIsValid(extension_id.key()))
+ if (!crx_file::id_util::IdIsValid(extension_id.key()))
continue;
scoped_ptr<ExtensionInfo> info =
@@ -1422,7 +1423,7 @@ ExtensionPrefs::GetUninstalledExtensionsInfo() const {
for (base::DictionaryValue::Iterator extension_id(*extensions);
!extension_id.IsAtEnd(); extension_id.Advance()) {
const base::DictionaryValue* ext = NULL;
- if (!Extension::IdIsValid(extension_id.key()) ||
+ if (!crx_file::id_util::IdIsValid(extension_id.key()) ||
!IsExternalExtensionUninstalled(extension_id.key()) ||
!extension_id.value().GetAsDictionary(&ext))
continue;
@@ -1478,7 +1479,7 @@ bool ExtensionPrefs::RemoveDelayedInstallInfo(
bool ExtensionPrefs::FinishDelayedInstallInfo(
const std::string& extension_id) {
- CHECK(Extension::IdIsValid(extension_id));
+ CHECK(crx_file::id_util::IdIsValid(extension_id));
ScopedExtensionPrefUpdate update(prefs_, extension_id);
base::DictionaryValue* extension_dict = update.Get();
base::DictionaryValue* pending_install_dict = NULL;
@@ -1561,7 +1562,7 @@ scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs::
prefs_->GetDictionary(pref_names::kExtensions);
for (base::DictionaryValue::Iterator extension_id(*extensions);
!extension_id.IsAtEnd(); extension_id.Advance()) {
- if (!Extension::IdIsValid(extension_id.key()))
+ if (!crx_file::id_util::IdIsValid(extension_id.key()))
continue;
scoped_ptr<ExtensionInfo> info = GetDelayedInstallInfo(extension_id.key());
@@ -1712,7 +1713,7 @@ base::Time ExtensionPrefs::GetLastLaunchTime(
void ExtensionPrefs::SetLastLaunchTime(const std::string& extension_id,
const base::Time& time) {
- DCHECK(Extension::IdIsValid(extension_id));
+ DCHECK(crx_file::id_util::IdIsValid(extension_id));
ScopedExtensionPrefUpdate update(prefs_, extension_id);
SaveTime(update.Get(), kPrefLastLaunchTime, time);
}
« no previous file with comments | « extensions/browser/extension_message_filter.cc ('k') | extensions/browser/external_provider_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698