| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_STATE_STORE_H_ | 5 #ifndef EXTENSIONS_BROWSER_STATE_STORE_H_ |
| 6 #define EXTENSIONS_BROWSER_STATE_STORE_H_ | 6 #define EXTENSIONS_BROWSER_STATE_STORE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // Return whether or not the StateStore has initialized itself. | 67 // Return whether or not the StateStore has initialized itself. |
| 68 bool IsInitialized() const; | 68 bool IsInitialized() const; |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 class DelayedTaskQueue; | 71 class DelayedTaskQueue; |
| 72 | 72 |
| 73 // content::NotificationObserver | 73 // content::NotificationObserver |
| 74 virtual void Observe(int type, | 74 virtual void Observe(int type, |
| 75 const content::NotificationSource& source, | 75 const content::NotificationSource& source, |
| 76 const content::NotificationDetails& details) OVERRIDE; | 76 const content::NotificationDetails& details) override; |
| 77 | 77 |
| 78 void Init(); | 78 void Init(); |
| 79 | 79 |
| 80 // When StateStore is constructed with |deferred_load| its initialization is | 80 // When StateStore is constructed with |deferred_load| its initialization is |
| 81 // delayed to avoid slowing down startup. | 81 // delayed to avoid slowing down startup. |
| 82 void InitAfterDelay(); | 82 void InitAfterDelay(); |
| 83 | 83 |
| 84 // Removes all keys registered for the given extension. | 84 // Removes all keys registered for the given extension. |
| 85 void RemoveKeysForExtension(const std::string& extension_id); | 85 void RemoveKeysForExtension(const std::string& extension_id); |
| 86 | 86 |
| 87 // ExtensionRegistryObserver implementation. | 87 // ExtensionRegistryObserver implementation. |
| 88 virtual void OnExtensionUninstalled( | 88 virtual void OnExtensionUninstalled( |
| 89 content::BrowserContext* browser_context, | 89 content::BrowserContext* browser_context, |
| 90 const Extension* extension, | 90 const Extension* extension, |
| 91 extensions::UninstallReason reason) OVERRIDE; | 91 extensions::UninstallReason reason) override; |
| 92 virtual void OnExtensionWillBeInstalled( | 92 virtual void OnExtensionWillBeInstalled( |
| 93 content::BrowserContext* browser_context, | 93 content::BrowserContext* browser_context, |
| 94 const Extension* extension, | 94 const Extension* extension, |
| 95 bool is_update, | 95 bool is_update, |
| 96 bool from_ephemeral, | 96 bool from_ephemeral, |
| 97 const std::string& old_name) OVERRIDE; | 97 const std::string& old_name) override; |
| 98 | 98 |
| 99 // Path to our database, on disk. Empty during testing. | 99 // Path to our database, on disk. Empty during testing. |
| 100 base::FilePath db_path_; | 100 base::FilePath db_path_; |
| 101 | 101 |
| 102 // The store that holds our key/values. | 102 // The store that holds our key/values. |
| 103 ValueStoreFrontend store_; | 103 ValueStoreFrontend store_; |
| 104 | 104 |
| 105 // List of all known keys. They will be cleared for each extension when it is | 105 // List of all known keys. They will be cleared for each extension when it is |
| 106 // (un)installed. | 106 // (un)installed. |
| 107 std::set<std::string> registered_keys_; | 107 std::set<std::string> registered_keys_; |
| 108 | 108 |
| 109 // Keeps track of tasks we have delayed while starting up. | 109 // Keeps track of tasks we have delayed while starting up. |
| 110 scoped_ptr<DelayedTaskQueue> task_queue_; | 110 scoped_ptr<DelayedTaskQueue> task_queue_; |
| 111 | 111 |
| 112 content::NotificationRegistrar registrar_; | 112 content::NotificationRegistrar registrar_; |
| 113 | 113 |
| 114 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 114 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 115 extension_registry_observer_; | 115 extension_registry_observer_; |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace extensions | 118 } // namespace extensions |
| 119 | 119 |
| 120 #endif // EXTENSIONS_BROWSER_STATE_STORE_H_ | 120 #endif // EXTENSIONS_BROWSER_STATE_STORE_H_ |
| OLD | NEW |