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

Unified Diff: chrome/browser/extensions/install_verifier.cc

Issue 464463003: Adding logging of offstore extensions state to user metrics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: chrome/browser/extensions/install_verifier.cc
diff --git a/chrome/browser/extensions/install_verifier.cc b/chrome/browser/extensions/install_verifier.cc
index 9cfb94cce09da5d9ce3047b308ab252b8c5f75ed..1748e2a787757c3c846fa9f073da945bf9550dd8 100644
--- a/chrome/browser/extensions/install_verifier.cc
+++ b/chrome/browser/extensions/install_verifier.cc
@@ -128,19 +128,6 @@ void LogInitResultHistogram(InitResult result) {
result, INIT_RESULT_MAX);
}
-bool FromStore(const Extension& extension) {
- if (extension.from_webstore() || ManifestURL::UpdatesFromGallery(&extension))
- return true;
-
- // If an extension has no update url, our autoupdate code will ask the
- // webstore about it (to aid in migrating to the webstore from self-hosting
- // or sideloading based installs). So we want to do verification checks on
- // such extensions too so that we don't accidentally disable old installs of
- // extensions that did migrate to the webstore.
- return (ManifestURL::GetUpdateURL(&extension).is_empty() &&
- Manifest::IsAutoUpdateableLocation(extension.location()));
-}
-
bool CanUseExtensionApis(const Extension& extension) {
return extension.is_extension() || extension.is_legacy_packaged_app();
}
@@ -242,11 +229,20 @@ base::Time InstallVerifier::SignatureTimestamp() {
return base::Time();
}
-bool InstallVerifier::IsKnownId(const std::string& id) {
+bool InstallVerifier::IsKnownId(const std::string& id) const {
return signature_.get() && (ContainsKey(signature_->ids, id) ||
ContainsKey(signature_->invalid_ids, id));
}
+bool InstallVerifier::IsVerified(const std::string& id) const {
+ return ((signature_.get() && ContainsKey(signature_->ids, id)) ||
+ ContainsKey(provisional_, id));
+}
+
+bool InstallVerifier::IsInvalid(const std::string& id) const {
+ return ((signature_.get() && ContainsKey(signature_->invalid_ids, id)));
+}
+
void InstallVerifier::VerifyExtension(const std::string& extension_id) {
ExtensionIdSet ids;
ids.insert(extension_id);
@@ -314,6 +310,38 @@ void InstallVerifier::RemoveMany(const ExtensionIdSet& ids) {
BeginFetch();
}
+bool InstallVerifier::AllowedByEnterprisePolicy(const std::string& id) const {
+ PrefService* pref_service = prefs_->pref_service();
+ if (pref_service->IsManagedPreference(pref_names::kInstallAllowList)) {
+ const base::ListValue* whitelist =
+ pref_service->GetList(pref_names::kInstallAllowList);
+ base::StringValue id_value(id);
+ if (whitelist && whitelist->Find(id_value) != whitelist->end())
+ return true;
+ }
+ if (pref_service->IsManagedPreference(pref_names::kInstallForceList)) {
+ const base::DictionaryValue* forcelist =
+ pref_service->GetDictionary(pref_names::kInstallForceList);
+ if (forcelist && forcelist->HasKey(id))
+ return true;
+ }
+ return false;
+}
+
+// static
+bool InstallVerifier::FromStore(const Extension& extension) {
+ if (extension.from_webstore() || ManifestURL::UpdatesFromGallery(&extension))
+ return true;
+
+ // If an extension has no update url, our autoupdate code will ask the
+ // webstore about it (to aid in migrating to the webstore from self-hosting
+ // or sideloading based installs). So we want to do verification checks on
+ // such extensions too so that we don't accidentally disable old installs of
+ // extensions that did migrate to the webstore.
+ return (ManifestURL::GetUpdateURL(&extension).is_empty() &&
+ Manifest::IsAutoUpdateableLocation(extension.location()));
+}
+
std::string InstallVerifier::GetDebugPolicyProviderName() const {
return std::string("InstallVerifier");
}
@@ -510,29 +538,6 @@ void InstallVerifier::GarbageCollect() {
}
}
-bool InstallVerifier::AllowedByEnterprisePolicy(const std::string& id) const {
- PrefService* pref_service = prefs_->pref_service();
- if (pref_service->IsManagedPreference(pref_names::kInstallAllowList)) {
- const base::ListValue* whitelist =
- pref_service->GetList(pref_names::kInstallAllowList);
- base::StringValue id_value(id);
- if (whitelist && whitelist->Find(id_value) != whitelist->end())
- return true;
- }
- if (pref_service->IsManagedPreference(pref_names::kInstallForceList)) {
- const base::DictionaryValue* forcelist =
- pref_service->GetDictionary(pref_names::kInstallForceList);
- if (forcelist && forcelist->HasKey(id))
- return true;
- }
- return false;
-}
-
-bool InstallVerifier::IsVerified(const std::string& id) const {
- return ((signature_.get() && ContainsKey(signature_->ids, id)) ||
- ContainsKey(provisional_, id));
-}
-
void InstallVerifier::BeginFetch() {
DCHECK(ShouldFetchSignature());

Powered by Google App Engine
This is Rietveld 408576698