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

Side by Side Diff: extensions/browser/api/storage/storage_frontend.h

Issue 1902873002: Convert //extensions/browser/api 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
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_API_STORAGE_STORAGE_FRONTEND_H_ 5 #ifndef EXTENSIONS_BROWSER_API_STORAGE_STORAGE_FRONTEND_H_
6 #define EXTENSIONS_BROWSER_API_STORAGE_STORAGE_FRONTEND_H_ 6 #define EXTENSIONS_BROWSER_API_STORAGE_STORAGE_FRONTEND_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <string> 10 #include <string>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "extensions/browser/api/storage/settings_namespace.h" 14 #include "extensions/browser/api/storage/settings_namespace.h"
15 #include "extensions/browser/api/storage/settings_observer.h" 15 #include "extensions/browser/api/storage/settings_observer.h"
16 #include "extensions/browser/api/storage/value_store_cache.h" 16 #include "extensions/browser/api/storage/value_store_cache.h"
17 #include "extensions/browser/browser_context_keyed_api_factory.h" 17 #include "extensions/browser/browser_context_keyed_api_factory.h"
18 18
19 namespace content { 19 namespace content {
20 class BrowserContext; 20 class BrowserContext;
21 } 21 }
22 22
23 namespace extensions { 23 namespace extensions {
24 24
25 class ValueStoreFactory; 25 class ValueStoreFactory;
26 26
27 // The component of the Storage API which runs on the UI thread. 27 // The component of the Storage API which runs on the UI thread.
28 class StorageFrontend : public BrowserContextKeyedAPI { 28 class StorageFrontend : public BrowserContextKeyedAPI {
29 public: 29 public:
30 // Returns the current instance for |context|. 30 // Returns the current instance for |context|.
31 static StorageFrontend* Get(content::BrowserContext* context); 31 static StorageFrontend* Get(content::BrowserContext* context);
32 32
33 // Creates with a specific |storage_factory|. 33 // Creates with a specific |storage_factory|.
34 static scoped_ptr<StorageFrontend> CreateForTesting( 34 static std::unique_ptr<StorageFrontend> CreateForTesting(
35 const scoped_refptr<ValueStoreFactory>& storage_factory, 35 const scoped_refptr<ValueStoreFactory>& storage_factory,
36 content::BrowserContext* context); 36 content::BrowserContext* context);
37 37
38 // Public so tests can create and delete their own instances. 38 // Public so tests can create and delete their own instances.
39 ~StorageFrontend() override; 39 ~StorageFrontend() override;
40 40
41 // Returns the value store cache for |settings_namespace|. 41 // Returns the value store cache for |settings_namespace|.
42 ValueStoreCache* GetValueStoreCache( 42 ValueStoreCache* GetValueStoreCache(
43 settings_namespace::Namespace settings_namespace) const; 43 settings_namespace::Namespace settings_namespace) const;
44 44
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 void Init(const scoped_refptr<ValueStoreFactory>& storage_factory); 81 void Init(const scoped_refptr<ValueStoreFactory>& storage_factory);
82 82
83 // The (non-incognito) browser context this Frontend belongs to. 83 // The (non-incognito) browser context this Frontend belongs to.
84 content::BrowserContext* const browser_context_; 84 content::BrowserContext* const browser_context_;
85 85
86 // List of observers to settings changes. 86 // List of observers to settings changes.
87 scoped_refptr<SettingsObserverList> observers_; 87 scoped_refptr<SettingsObserverList> observers_;
88 88
89 // Observer for |browser_context_|. 89 // Observer for |browser_context_|.
90 scoped_ptr<SettingsObserver> browser_context_observer_; 90 std::unique_ptr<SettingsObserver> browser_context_observer_;
91 91
92 // Maps a known namespace to its corresponding ValueStoreCache. The caches 92 // Maps a known namespace to its corresponding ValueStoreCache. The caches
93 // are owned by this object. 93 // are owned by this object.
94 CacheMap caches_; 94 CacheMap caches_;
95 95
96 DISALLOW_COPY_AND_ASSIGN(StorageFrontend); 96 DISALLOW_COPY_AND_ASSIGN(StorageFrontend);
97 }; 97 };
98 98
99 } // namespace extensions 99 } // namespace extensions
100 100
101 #endif // EXTENSIONS_BROWSER_API_STORAGE_STORAGE_FRONTEND_H_ 101 #endif // EXTENSIONS_BROWSER_API_STORAGE_STORAGE_FRONTEND_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/storage/storage_api_unittest.cc ('k') | extensions/browser/api/storage/storage_frontend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698