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

Side by Side Diff: chrome/browser/extensions/api/storage/policy_value_store.h

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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
OLDNEW
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_POLICY_VALUE_STORE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_POLICY_VALUE_STORE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_POLICY_VALUE_STORE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_POLICY_VALUE_STORE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "extensions/browser/api/storage/settings_observer.h" 17 #include "extensions/browser/api/storage/settings_observer.h"
18 #include "extensions/browser/value_store/value_store.h" 18 #include "extensions/browser/value_store/value_store.h"
19 19
20 namespace policy { 20 namespace policy {
21 class PolicyMap; 21 class PolicyMap;
22 } 22 }
23 23
24 namespace extensions { 24 namespace extensions {
25 25
26 // A ValueStore that is backed by another, persistent ValueStore, and stores 26 // A ValueStore that is backed by another, persistent ValueStore, and stores
27 // the policies for a specific extension there. This ValueStore is used to 27 // the policies for a specific extension there. This ValueStore is used to
28 // run the function of the storage.managed namespace; it's read-only for the 28 // run the function of the storage.managed namespace; it's read-only for the
29 // extension. The ManagedValueStoreCache sends updated policy to this store 29 // extension. The ManagedValueStoreCache sends updated policy to this store
30 // and manages its lifetime. 30 // and manages its lifetime.
31 class PolicyValueStore : public ValueStore { 31 class PolicyValueStore : public ValueStore {
32 public: 32 public:
33 PolicyValueStore(const std::string& extension_id, 33 PolicyValueStore(const std::string& extension_id,
34 const scoped_refptr<SettingsObserverList>& observers, 34 const scoped_refptr<SettingsObserverList>& observers,
35 scoped_ptr<ValueStore> delegate); 35 std::unique_ptr<ValueStore> delegate);
36 ~PolicyValueStore() override; 36 ~PolicyValueStore() override;
37 37
38 // Stores |policy| in the persistent database represented by the |delegate_| 38 // Stores |policy| in the persistent database represented by the |delegate_|
39 // and notifies observers with the changes from the previous policy. 39 // and notifies observers with the changes from the previous policy.
40 void SetCurrentPolicy(const policy::PolicyMap& policy); 40 void SetCurrentPolicy(const policy::PolicyMap& policy);
41 41
42 // Clears all the stored data and deletes the database. 42 // Clears all the stored data and deletes the database.
43 void DeleteStorage(); 43 void DeleteStorage();
44 44
45 // ValueStore implementation: 45 // ValueStore implementation:
(...skipping 11 matching lines...) Expand all
57 WriteResult Remove(const std::string& key) override; 57 WriteResult Remove(const std::string& key) override;
58 WriteResult Remove(const std::vector<std::string>& keys) override; 58 WriteResult Remove(const std::vector<std::string>& keys) override;
59 WriteResult Clear() override; 59 WriteResult Clear() override;
60 60
61 // For unit tests. 61 // For unit tests.
62 ValueStore* delegate() { return delegate_.get(); } 62 ValueStore* delegate() { return delegate_.get(); }
63 63
64 private: 64 private:
65 std::string extension_id_; 65 std::string extension_id_;
66 scoped_refptr<SettingsObserverList> observers_; 66 scoped_refptr<SettingsObserverList> observers_;
67 scoped_ptr<ValueStore> delegate_; 67 std::unique_ptr<ValueStore> delegate_;
68 68
69 DISALLOW_COPY_AND_ASSIGN(PolicyValueStore); 69 DISALLOW_COPY_AND_ASSIGN(PolicyValueStore);
70 }; 70 };
71 71
72 } // namespace extensions 72 } // namespace extensions
73 73
74 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_POLICY_VALUE_STORE_H_ 74 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_POLICY_VALUE_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698