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

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

Issue 1128753003: Add minimal profile creation version for default apps install on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed #ifdef 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
« no previous file with comments | « chrome/browser/extensions/external_provider_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/external_provider_impl.cc
diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc
index f3122881c0af2f3125e81b935d67ddd48c7b4fc1..12ab37ed85d7438b951be9c2668a21c4055e5555 100644
--- a/chrome/browser/extensions/external_provider_impl.cc
+++ b/chrome/browser/extensions/external_provider_impl.cc
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
#include "base/metrics/field_trial.h"
+#include "base/prefs/pref_service.h"
#include "base/strings/string_util.h"
#include "base/trace_event/trace_event.h"
#include "base/values.h"
@@ -26,6 +27,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/extension_system.h"
@@ -66,6 +68,8 @@ const char ExternalProviderImpl::kKeepIfPresent[] = "keep_if_present";
const char ExternalProviderImpl::kWasInstalledByOem[] = "was_installed_by_oem";
const char ExternalProviderImpl::kSupportedLocales[] = "supported_locales";
const char ExternalProviderImpl::kMayBeUntrusted[] = "may_be_untrusted";
+const char ExternalProviderImpl::kMinProfileCreatedByVersion[] =
+ "min_profile_created_by_version";
ExternalProviderImpl::ExternalProviderImpl(
VisitorInterface* service,
@@ -218,6 +222,7 @@ void ExternalProviderImpl::SetPrefs(base::DictionaryValue* prefs) {
const Extension* extension = extension_service ?
extension_service->GetExtensionById(extension_id, true) : NULL;
if (!extension) {
+ unsupported_extensions.insert(extension_id);
VLOG(1) << "Skip installing (or uninstall) external extension: "
<< extension_id << " because the extension should be kept "
<< "only if it is already installed.";
@@ -235,6 +240,10 @@ void ExternalProviderImpl::SetPrefs(base::DictionaryValue* prefs) {
creation_flags |= Extension::MAY_BE_UNTRUSTED;
}
+ if (!ExternalProviderImpl::HandleMinProfileVersion(extension, extension_id,
+ &unsupported_extensions))
+ continue;
+
std::string install_parameter;
extension->GetString(kInstallParam, &install_parameter);
@@ -360,6 +369,30 @@ bool ExternalProviderImpl::GetExtensionDetails(
return true;
}
+bool ExternalProviderImpl::HandleMinProfileVersion(
+ const base::DictionaryValue* extension,
+ const std::string& extension_id,
+ std::set<std::string>* unsupported_extensions) {
+ std::string min_profile_created_by_version;
+ if (profile_ &&
+ extension->GetString(kMinProfileCreatedByVersion,
+ &min_profile_created_by_version)) {
+ Version profile_version(
+ profile_->GetPrefs()->GetString(prefs::kProfileCreatedByVersion));
+ Version min_version(min_profile_created_by_version);
+ if (min_version.IsValid() && profile_version.CompareTo(min_version) < 0) {
+ unsupported_extensions->insert(extension_id);
+ VLOG(1) << "Skip installing (or uninstall) external extension: "
+ << extension_id
+ << " profile.created_by_version: " << profile_version.GetString()
+ << " min_profile_created_by_version: "
+ << min_profile_created_by_version;
+ return false;
+ }
+ }
+ return true;
+}
+
// static
void ExternalProviderImpl::CreateExternalProviders(
VisitorInterface* service,
« no previous file with comments | « chrome/browser/extensions/external_provider_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698