OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ |
7 | 7 |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
17 #include "chrome/browser/extensions/updater/local_extension_cache.h" | 17 #include "chrome/browser/extensions/updater/local_extension_cache.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 #include "extensions/browser/updater/extension_downloader_delegate.h" | 20 #include "extensions/browser/updater/extension_downloader_delegate.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class DictionaryValue; | 23 class DictionaryValue; |
24 } | 24 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 bool GetExtensionExistingVersion(const std::string& id, | 103 bool GetExtensionExistingVersion(const std::string& id, |
104 std::string* version) override; | 104 std::string* version) override; |
105 | 105 |
106 // Shut down the cache. The |callback| will be invoked when the cache has shut | 106 // Shut down the cache. The |callback| will be invoked when the cache has shut |
107 // down completely and there are no more pending file I/O operations. | 107 // down completely and there are no more pending file I/O operations. |
108 void Shutdown(const base::Closure& callback); | 108 void Shutdown(const base::Closure& callback); |
109 | 109 |
110 // Replace the list of extensions to cache with |prefs| and perform update | 110 // Replace the list of extensions to cache with |prefs| and perform update |
111 // checks for these. | 111 // checks for these. |
112 void UpdateExtensionsList(scoped_ptr<base::DictionaryValue> prefs); | 112 void UpdateExtensionsList(std::unique_ptr<base::DictionaryValue> prefs); |
113 | 113 |
114 // If a user of one of the ExternalCache's extensions detects that | 114 // If a user of one of the ExternalCache's extensions detects that |
115 // the extension is damaged then this method can be used to remove it from | 115 // the extension is damaged then this method can be used to remove it from |
116 // the cache and retry to download it after a restart. | 116 // the cache and retry to download it after a restart. |
117 void OnDamagedFileDetected(const base::FilePath& path); | 117 void OnDamagedFileDetected(const base::FilePath& path); |
118 | 118 |
119 // Removes extensions listed in |ids| from external cache, corresponding crx | 119 // Removes extensions listed in |ids| from external cache, corresponding crx |
120 // files will be removed from disk too. | 120 // files will be removed from disk too. |
121 void RemoveExtensions(const std::vector<std::string>& ids); | 121 void RemoveExtensions(const std::vector<std::string>& ids); |
122 | 122 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Updates needs to be check for the extensions with external_crx too. | 170 // Updates needs to be check for the extensions with external_crx too. |
171 bool always_check_updates_; | 171 bool always_check_updates_; |
172 | 172 |
173 // Set to true if cache should wait for initialization flag file. | 173 // Set to true if cache should wait for initialization flag file. |
174 bool wait_for_cache_initialization_; | 174 bool wait_for_cache_initialization_; |
175 | 175 |
176 // Whether to flush the crx file after putting into |local_cache_|. | 176 // Whether to flush the crx file after putting into |local_cache_|. |
177 bool flush_on_put_ = false; | 177 bool flush_on_put_ = false; |
178 | 178 |
179 // This is the list of extensions currently configured. | 179 // This is the list of extensions currently configured. |
180 scoped_ptr<base::DictionaryValue> extensions_; | 180 std::unique_ptr<base::DictionaryValue> extensions_; |
181 | 181 |
182 // This contains extensions that are both currently configured | 182 // This contains extensions that are both currently configured |
183 // and that have a valid crx in the cache. | 183 // and that have a valid crx in the cache. |
184 scoped_ptr<base::DictionaryValue> cached_extensions_; | 184 std::unique_ptr<base::DictionaryValue> cached_extensions_; |
185 | 185 |
186 // Used to download the extensions and to check for updates. | 186 // Used to download the extensions and to check for updates. |
187 scoped_ptr<extensions::ExtensionDownloader> downloader_; | 187 std::unique_ptr<extensions::ExtensionDownloader> downloader_; |
188 | 188 |
189 // Observes failures to install CRX files. | 189 // Observes failures to install CRX files. |
190 content::NotificationRegistrar notification_registrar_; | 190 content::NotificationRegistrar notification_registrar_; |
191 | 191 |
192 // Weak factory for callbacks. | 192 // Weak factory for callbacks. |
193 base::WeakPtrFactory<ExternalCache> weak_ptr_factory_; | 193 base::WeakPtrFactory<ExternalCache> weak_ptr_factory_; |
194 | 194 |
195 DISALLOW_COPY_AND_ASSIGN(ExternalCache); | 195 DISALLOW_COPY_AND_ASSIGN(ExternalCache); |
196 }; | 196 }; |
197 | 197 |
198 } // namespace chromeos | 198 } // namespace chromeos |
199 | 199 |
200 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ | 200 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTERNAL_CACHE_H_ |
OLD | NEW |