Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: extensions/browser/state_store.h

Issue 1909773002: Convert //extensions/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/sandboxed_unpacker_unittest.cc ('k') | extensions/browser/state_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 public: 32 public:
33 typedef ValueStoreFrontend::ReadCallback ReadCallback; 33 typedef ValueStoreFrontend::ReadCallback ReadCallback;
34 34
35 // If |deferred_load| is true, we won't load the database until the first 35 // If |deferred_load| is true, we won't load the database until the first
36 // page has been loaded. 36 // page has been loaded.
37 StateStore(content::BrowserContext* context, 37 StateStore(content::BrowserContext* context,
38 const scoped_refptr<ValueStoreFactory>& store_factory, 38 const scoped_refptr<ValueStoreFactory>& store_factory,
39 ValueStoreFrontend::BackendType backend_type, 39 ValueStoreFrontend::BackendType backend_type,
40 bool deferred_load); 40 bool deferred_load);
41 // This variant is useful for testing (using a mock ValueStore). 41 // This variant is useful for testing (using a mock ValueStore).
42 StateStore(content::BrowserContext* context, scoped_ptr<ValueStore> store); 42 StateStore(content::BrowserContext* context,
43 std::unique_ptr<ValueStore> store);
43 ~StateStore() override; 44 ~StateStore() override;
44 45
45 // Requests that the state store to be initialized after its usual delay. Can 46 // Requests that the state store to be initialized after its usual delay. Can
46 // be explicitly called by an embedder when the embedder does not trigger the 47 // be explicitly called by an embedder when the embedder does not trigger the
47 // usual page load notifications. 48 // usual page load notifications.
48 void RequestInitAfterDelay(); 49 void RequestInitAfterDelay();
49 50
50 // Register a key for removal upon extension install/uninstall. We remove 51 // Register a key for removal upon extension install/uninstall. We remove
51 // for install to reset state when an extension upgrades. 52 // for install to reset state when an extension upgrades.
52 void RegisterKey(const std::string& key); 53 void RegisterKey(const std::string& key);
53 54
54 // Get the value associated with the given extension and key, and pass 55 // Get the value associated with the given extension and key, and pass
55 // it to |callback| asynchronously. 56 // it to |callback| asynchronously.
56 void GetExtensionValue(const std::string& extension_id, 57 void GetExtensionValue(const std::string& extension_id,
57 const std::string& key, 58 const std::string& key,
58 ReadCallback callback); 59 ReadCallback callback);
59 60
60 // Sets a value for a given extension and key. 61 // Sets a value for a given extension and key.
61 void SetExtensionValue(const std::string& extension_id, 62 void SetExtensionValue(const std::string& extension_id,
62 const std::string& key, 63 const std::string& key,
63 scoped_ptr<base::Value> value); 64 std::unique_ptr<base::Value> value);
64 65
65 // Removes a value for a given extension and key. 66 // Removes a value for a given extension and key.
66 void RemoveExtensionValue(const std::string& extension_id, 67 void RemoveExtensionValue(const std::string& extension_id,
67 const std::string& key); 68 const std::string& key);
68 69
69 // Return whether or not the StateStore has initialized itself. 70 // Return whether or not the StateStore has initialized itself.
70 bool IsInitialized() const; 71 bool IsInitialized() const;
71 72
72 private: 73 private:
73 class DelayedTaskQueue; 74 class DelayedTaskQueue;
(...skipping 15 matching lines...) Expand all
89 // ExtensionRegistryObserver implementation. 90 // ExtensionRegistryObserver implementation.
90 void OnExtensionUninstalled(content::BrowserContext* browser_context, 91 void OnExtensionUninstalled(content::BrowserContext* browser_context,
91 const Extension* extension, 92 const Extension* extension,
92 extensions::UninstallReason reason) override; 93 extensions::UninstallReason reason) override;
93 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context, 94 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
94 const Extension* extension, 95 const Extension* extension,
95 bool is_update, 96 bool is_update,
96 const std::string& old_name) override; 97 const std::string& old_name) override;
97 98
98 // The store that holds our key/values. 99 // The store that holds our key/values.
99 scoped_ptr<ValueStoreFrontend> store_; 100 std::unique_ptr<ValueStoreFrontend> store_;
100 101
101 // List of all known keys. They will be cleared for each extension when it is 102 // List of all known keys. They will be cleared for each extension when it is
102 // (un)installed. 103 // (un)installed.
103 std::set<std::string> registered_keys_; 104 std::set<std::string> registered_keys_;
104 105
105 // Keeps track of tasks we have delayed while starting up. 106 // Keeps track of tasks we have delayed while starting up.
106 scoped_ptr<DelayedTaskQueue> task_queue_; 107 std::unique_ptr<DelayedTaskQueue> task_queue_;
107 108
108 content::NotificationRegistrar registrar_; 109 content::NotificationRegistrar registrar_;
109 110
110 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 111 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
111 extension_registry_observer_; 112 extension_registry_observer_;
112 }; 113 };
113 114
114 } // namespace extensions 115 } // namespace extensions
115 116
116 #endif // EXTENSIONS_BROWSER_STATE_STORE_H_ 117 #endif // EXTENSIONS_BROWSER_STATE_STORE_H_
OLDNEW
« no previous file with comments | « extensions/browser/sandboxed_unpacker_unittest.cc ('k') | extensions/browser/state_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698