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

Side by Side Diff: chrome/browser/extensions/updater/local_extension_cache.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 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 CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_
6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory>
12 #include <string> 13 #include <string>
13 14
14 #include "base/callback_forward.h" 15 #include "base/callback_forward.h"
15 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 20
21 namespace extensions { 21 namespace extensions {
22 22
23 // Cache .crx files in some local dir for future use. Cache keeps only latest 23 // Cache .crx files in some local dir for future use. Cache keeps only latest
24 // version of the extensions. Only one instance of LocalExtensionCache can work 24 // version of the extensions. Only one instance of LocalExtensionCache can work
25 // with the same directory. But LocalExtensionCache instance can be shared 25 // with the same directory. But LocalExtensionCache instance can be shared
26 // between multiple clients. Public interface can be used only from UI thread. 26 // between multiple clients. Public interface can be used only from UI thread.
27 class LocalExtensionCache { 27 class LocalExtensionCache {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 const base::FilePath& cache_dir, 201 const base::FilePath& cache_dir,
202 const base::Closure& callback); 202 const base::Closure& callback);
203 203
204 // Helper for BackendCheckCacheContents() that updates |cache_content|. 204 // Helper for BackendCheckCacheContents() that updates |cache_content|.
205 static void BackendCheckCacheContentsInternal( 205 static void BackendCheckCacheContentsInternal(
206 const base::FilePath& cache_dir, 206 const base::FilePath& cache_dir,
207 CacheMap* cache_content); 207 CacheMap* cache_content);
208 208
209 // Invoked when the cache content on disk has been checked. |cache_content| 209 // Invoked when the cache content on disk has been checked. |cache_content|
210 // contains all the currently valid crx files in the cache. 210 // contains all the currently valid crx files in the cache.
211 void OnCacheContentsChecked(scoped_ptr<CacheMap> cache_content, 211 void OnCacheContentsChecked(std::unique_ptr<CacheMap> cache_content,
212 const base::Closure& callback); 212 const base::Closure& callback);
213 213
214 // Update timestamp for the file to mark it as "used". This method is invoked 214 // Update timestamp for the file to mark it as "used". This method is invoked
215 // via the |backend_task_runner_|. 215 // via the |backend_task_runner_|.
216 static void BackendMarkFileUsed(const base::FilePath& file_path, 216 static void BackendMarkFileUsed(const base::FilePath& file_path,
217 const base::Time& time); 217 const base::Time& time);
218 218
219 // Installs the downloaded crx file at |path| in the |cache_dir|. This method 219 // Installs the downloaded crx file at |path| in the |cache_dir|. This method
220 // is invoked via the |backend_task_runner_|. 220 // is invoked via the |backend_task_runner_|.
221 static void BackendInstallCacheEntry( 221 static void BackendInstallCacheEntry(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 // Weak factory for callbacks from the backend and delayed tasks. 271 // Weak factory for callbacks from the backend and delayed tasks.
272 base::WeakPtrFactory<LocalExtensionCache> weak_ptr_factory_; 272 base::WeakPtrFactory<LocalExtensionCache> weak_ptr_factory_;
273 273
274 DISALLOW_COPY_AND_ASSIGN(LocalExtensionCache); 274 DISALLOW_COPY_AND_ASSIGN(LocalExtensionCache);
275 }; 275 };
276 276
277 } // namespace extensions 277 } // namespace extensions
278 278
279 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_ 279 #endif // CHROME_BROWSER_EXTENSIONS_UPDATER_LOCAL_EXTENSION_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698