| 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_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/extensions/settings/settings_observer.h" |
| 10 #include "chrome/browser/extensions/settings/value_store_cache.h" | 12 #include "chrome/browser/extensions/settings/value_store_cache.h" |
| 11 | 13 #include "chrome/browser/policy/policy_service.h" |
| 12 namespace policy { | |
| 13 class PolicyService; | |
| 14 } // namespace policy | |
| 15 | 14 |
| 16 namespace extensions { | 15 namespace extensions { |
| 17 | 16 |
| 18 // Runs the StorageCallback with a read-only ValueStore that pulls values from | 17 // Runs the StorageCallback with a read-only ValueStore that pulls values from |
| 19 // the PolicyService for the given extension. | 18 // the PolicyService for the given extension. |
| 20 class ManagedValueStoreCache : public ValueStoreCache { | 19 class ManagedValueStoreCache : public ValueStoreCache, |
| 20 public policy::PolicyService::Observer { |
| 21 public: | 21 public: |
| 22 explicit ManagedValueStoreCache(policy::PolicyService* policy_service); | 22 ManagedValueStoreCache(policy::PolicyService* policy_service, |
| 23 scoped_refptr<SettingsObserverList> observers); |
| 23 virtual ~ManagedValueStoreCache(); | 24 virtual ~ManagedValueStoreCache(); |
| 24 | 25 |
| 25 // ValueStoreCache implementation: | 26 // ValueStoreCache implementation: |
| 26 | 27 |
| 28 virtual void ShutdownOnUI() OVERRIDE; |
| 29 |
| 27 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() const OVERRIDE; | 30 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() const OVERRIDE; |
| 28 | 31 |
| 29 virtual void RunWithValueStoreForExtension( | 32 virtual void RunWithValueStoreForExtension( |
| 30 const StorageCallback& callback, | 33 const StorageCallback& callback, |
| 31 scoped_refptr<const Extension> extension) OVERRIDE; | 34 scoped_refptr<const Extension> extension) OVERRIDE; |
| 32 | 35 |
| 33 virtual void DeleteStorageSoon(const std::string& extension_id) OVERRIDE; | 36 virtual void DeleteStorageSoon(const std::string& extension_id) OVERRIDE; |
| 34 | 37 |
| 38 // PolicyService::Observer implementation: |
| 39 |
| 40 virtual void OnPolicyUpdated(policy::PolicyDomain domain, |
| 41 const std::string& component_id, |
| 42 const policy::PolicyMap& previous, |
| 43 const policy::PolicyMap& current) OVERRIDE; |
| 44 |
| 35 private: | 45 private: |
| 36 policy::PolicyService* policy_service_; | 46 policy::PolicyService* policy_service_; |
| 37 | 47 |
| 48 scoped_refptr<SettingsObserverList> observers_; |
| 49 |
| 38 DISALLOW_COPY_AND_ASSIGN(ManagedValueStoreCache); | 50 DISALLOW_COPY_AND_ASSIGN(ManagedValueStoreCache); |
| 39 }; | 51 }; |
| 40 | 52 |
| 41 } // namespace extensions | 53 } // namespace extensions |
| 42 | 54 |
| 43 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ | 55 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_MANAGED_VALUE_STORE_CACHE_H_ |
| OLD | NEW |