OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/storage/managed_value_store_cache.h" | 5 #include "chrome/browser/extensions/api/storage/managed_value_store_cache.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
14 #include "base/scoped_observer.h" | 16 #include "base/scoped_observer.h" |
15 #include "chrome/browser/extensions/api/storage/policy_value_store.h" | 17 #include "chrome/browser/extensions/api/storage/policy_value_store.h" |
16 #include "chrome/browser/policy/profile_policy_connector.h" | 18 #include "chrome/browser/policy/profile_policy_connector.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 bool is_update, | 126 bool is_update, |
125 const std::string& old_name) { | 127 const std::string& old_name) { |
126 // Some extensions are installed on the first run before the ExtensionSystem | 128 // Some extensions are installed on the first run before the ExtensionSystem |
127 // becomes ready. Wait until all of them are ready before registering the | 129 // becomes ready. Wait until all of them are ready before registering the |
128 // schemas of managed extensions, so that the policy loaders are reloaded at | 130 // schemas of managed extensions, so that the policy loaders are reloaded at |
129 // most once. | 131 // most once. |
130 if (!ExtensionSystem::Get(profile_)->ready().is_signaled()) | 132 if (!ExtensionSystem::Get(profile_)->ready().is_signaled()) |
131 return; | 133 return; |
132 scoped_ptr<ExtensionSet> added(new ExtensionSet); | 134 scoped_ptr<ExtensionSet> added(new ExtensionSet); |
133 added->Insert(extension); | 135 added->Insert(extension); |
134 LoadSchemas(added.Pass()); | 136 LoadSchemas(std::move(added)); |
135 } | 137 } |
136 | 138 |
137 void ManagedValueStoreCache::ExtensionTracker::OnExtensionUninstalled( | 139 void ManagedValueStoreCache::ExtensionTracker::OnExtensionUninstalled( |
138 content::BrowserContext* browser_context, | 140 content::BrowserContext* browser_context, |
139 const Extension* extension, | 141 const Extension* extension, |
140 extensions::UninstallReason reason) { | 142 extensions::UninstallReason reason) { |
141 if (!ExtensionSystem::Get(profile_)->ready().is_signaled()) | 143 if (!ExtensionSystem::Get(profile_)->ready().is_signaled()) |
142 return; | 144 return; |
143 if (extension && UsesManagedStorage(extension)) { | 145 if (extension && UsesManagedStorage(extension)) { |
144 schema_registry_->UnregisterComponent(policy::PolicyNamespace( | 146 schema_registry_->UnregisterComponent(policy::PolicyNamespace( |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 368 |
367 return store; | 369 return store; |
368 } | 370 } |
369 | 371 |
370 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { | 372 bool ManagedValueStoreCache::HasStore(const std::string& extension_id) const { |
371 // TODO(joaodasilva): move this check to a ValueStore method. | 373 // TODO(joaodasilva): move this check to a ValueStore method. |
372 return base::DirectoryExists(base_path_.AppendASCII(extension_id)); | 374 return base::DirectoryExists(base_path_.AppendASCII(extension_id)); |
373 } | 375 } |
374 | 376 |
375 } // namespace extensions | 377 } // namespace extensions |
OLD | NEW |