| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "components/policy/core/common/policy_service.h" | 17 #include "components/policy/core/common/policy_service.h" |
| 18 #include "extensions/browser/api/storage/settings_observer.h" | 18 #include "extensions/browser/api/storage/settings_observer.h" |
| 19 #include "extensions/browser/api/storage/value_store_cache.h" | 19 #include "extensions/browser/api/storage/value_store_cache.h" |
| 20 | 20 |
| 21 class Profile; | 21 class Profile; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class BrowserContext; | 24 class BrowserContext; |
| 25 } | 25 } |
| 26 | 26 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 // PolicyService::Observer implementation: | 65 // PolicyService::Observer implementation: |
| 66 void OnPolicyServiceInitialized(policy::PolicyDomain domain) override; | 66 void OnPolicyServiceInitialized(policy::PolicyDomain domain) override; |
| 67 void OnPolicyUpdated(const policy::PolicyNamespace& ns, | 67 void OnPolicyUpdated(const policy::PolicyNamespace& ns, |
| 68 const policy::PolicyMap& previous, | 68 const policy::PolicyMap& previous, |
| 69 const policy::PolicyMap& current) override; | 69 const policy::PolicyMap& current) override; |
| 70 | 70 |
| 71 // Posted by OnPolicyUpdated() to update a PolicyValueStore on the FILE | 71 // Posted by OnPolicyUpdated() to update a PolicyValueStore on the FILE |
| 72 // thread. | 72 // thread. |
| 73 void UpdatePolicyOnFILE(const std::string& extension_id, | 73 void UpdatePolicyOnFILE(const std::string& extension_id, |
| 74 scoped_ptr<policy::PolicyMap> current_policy); | 74 std::unique_ptr<policy::PolicyMap> current_policy); |
| 75 | 75 |
| 76 // Returns an existing PolicyValueStore for |extension_id|, or NULL. | 76 // Returns an existing PolicyValueStore for |extension_id|, or NULL. |
| 77 PolicyValueStore* GetStoreFor(const std::string& extension_id); | 77 PolicyValueStore* GetStoreFor(const std::string& extension_id); |
| 78 | 78 |
| 79 // Returns true if a backing store has been created for |extension_id|. | 79 // Returns true if a backing store has been created for |extension_id|. |
| 80 bool HasStore(const std::string& extension_id) const; | 80 bool HasStore(const std::string& extension_id) const; |
| 81 | 81 |
| 82 // The profile that owns the extension system being used. This is used to | 82 // The profile that owns the extension system being used. This is used to |
| 83 // get the PolicyService, the EventRouter and the ExtensionService. | 83 // get the PolicyService, the EventRouter and the ExtensionService. |
| 84 Profile* profile_; | 84 Profile* profile_; |
| 85 | 85 |
| 86 // The |profile_|'s PolicyService. | 86 // The |profile_|'s PolicyService. |
| 87 policy::PolicyService* policy_service_; | 87 policy::PolicyService* policy_service_; |
| 88 | 88 |
| 89 // Observes extension loading and unloading, and keeps the Profile's | 89 // Observes extension loading and unloading, and keeps the Profile's |
| 90 // PolicyService aware of the current list of extensions. | 90 // PolicyService aware of the current list of extensions. |
| 91 scoped_ptr<ExtensionTracker> extension_tracker_; | 91 std::unique_ptr<ExtensionTracker> extension_tracker_; |
| 92 | 92 |
| 93 // These live on the FILE thread. | 93 // These live on the FILE thread. |
| 94 scoped_refptr<ValueStoreFactory> storage_factory_; | 94 scoped_refptr<ValueStoreFactory> storage_factory_; |
| 95 scoped_refptr<SettingsObserverList> observers_; | 95 scoped_refptr<SettingsObserverList> observers_; |
| 96 | 96 |
| 97 // All the PolicyValueStores live on the FILE thread, and |store_map_| can be | 97 // All the PolicyValueStores live on the FILE thread, and |store_map_| can be |
| 98 // accessed only on the FILE thread as well. | 98 // accessed only on the FILE thread as well. |
| 99 PolicyValueStoreMap store_map_; | 99 PolicyValueStoreMap store_map_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(ManagedValueStoreCache); | 101 DISALLOW_COPY_AND_ASSIGN(ManagedValueStoreCache); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace extensions | 104 } // namespace extensions |
| 105 | 105 |
| 106 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ | 106 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_MANAGED_VALUE_STORE_CACHE_H_ |
| OLD | NEW |