Chromium Code Reviews| 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); |
| } |