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

Unified Diff: chrome/browser/extensions/api/storage/managed_value_store_cache.cc

Issue 78953002: Fixes and improvements to cloud policy for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | chrome/browser/policy/cloud/component_cloud_policy_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/storage/managed_value_store_cache.cc
diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
index 82f7ce4efdb94d1062ba4ca1626572c9acebdf3c..26edb9700b036745548a12f027e8bb14210333cc 100644
--- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
+++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc
@@ -106,6 +106,13 @@ void ManagedValueStoreCache::ExtensionTracker::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
+ // Some extensions are installed on the first run before the ExtensionService
+ // becomes ready. Wait until all of them are ready before registering the
+ // schemas of managed extensions, so that the policy loaders are reloaded at
+ // most once.
+ if (!ExtensionSystem::Get(profile_)->ready().is_signaled())
+ return;
+
scoped_ptr<ExtensionSet> added;
const Extension* removed = NULL;
@@ -328,6 +335,15 @@ void ManagedValueStoreCache::UpdatePolicyOnFILE(
const std::string& extension_id,
scoped_ptr<policy::PolicyMap> current_policy) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+
+ if (!base::DirectoryExists(base_path_.AppendASCII(extension_id)) &&
not at google - send to devlin 2013/11/20 19:02:53 perhaps pull this into a local method like StoreEx
+ current_policy->empty()) {
+ // Don't create the store now if there are no concrete policies configured
+ // for this extension. If the extension uses the storage.managed API then
+ // the store will be created at RunWithValueStoreForExtension().
+ return;
+ }
+
GetStoreFor(extension_id)->SetCurrentPolicy(*current_policy);
}
« no previous file with comments | « no previous file | chrome/browser/policy/cloud/component_cloud_policy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698