OLD | NEW |
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_CRX_INSTALLER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
7 | 7 |
| 8 #include <map> |
| 9 #include <set> |
8 #include <string> | 10 #include <string> |
| 11 #include <vector> |
9 | 12 |
10 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
11 #include "base/file_path.h" | 14 #include "base/file_path.h" |
12 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
14 #include "base/version.h" | 17 #include "base/version.h" |
15 #include "chrome/browser/extensions/crx_installer_error.h" | 18 #include "chrome/browser/extensions/crx_installer_error.h" |
16 #include "chrome/browser/extensions/extension_install_prompt.h" | 19 #include "chrome/browser/extensions/extension_install_prompt.h" |
17 #include "chrome/browser/extensions/sandboxed_unpacker.h" | 20 #include "chrome/browser/extensions/sandboxed_unpacker.h" |
18 #include "chrome/browser/extensions/webstore_installer.h" | 21 #include "chrome/browser/extensions/webstore_installer.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 166 } |
164 | 167 |
165 void set_page_ordinal(const syncer::StringOrdinal& page_ordinal) { | 168 void set_page_ordinal(const syncer::StringOrdinal& page_ordinal) { |
166 page_ordinal_ = page_ordinal; | 169 page_ordinal_ = page_ordinal; |
167 } | 170 } |
168 | 171 |
169 void set_error_on_unsupported_requirements(bool val) { | 172 void set_error_on_unsupported_requirements(bool val) { |
170 error_on_unsupported_requirements_ = val; | 173 error_on_unsupported_requirements_ = val; |
171 } | 174 } |
172 | 175 |
| 176 void set_preload_sizes(const std::set<int>& sizes) { preload_sizes_ = sizes; } |
| 177 |
173 bool did_handle_successfully() const { return did_handle_successfully_; } | 178 bool did_handle_successfully() const { return did_handle_successfully_; } |
174 | 179 |
175 Profile* profile() { return profile_; } | 180 Profile* profile() { return profile_; } |
176 | 181 |
177 private: | 182 private: |
178 friend class ExtensionUpdaterTest; | 183 friend class ExtensionUpdaterTest; |
179 friend class ExtensionCrxInstallerTest; | 184 friend class ExtensionCrxInstallerTest; |
180 | 185 |
181 CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, | 186 CrxInstaller(base::WeakPtr<ExtensionService> frontend_weak, |
182 ExtensionInstallPrompt* client, | 187 ExtensionInstallPrompt* client, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // notify the frontend. | 223 // notify the frontend. |
219 void CompleteInstall(); | 224 void CompleteInstall(); |
220 | 225 |
221 // Result reporting. | 226 // Result reporting. |
222 void ReportFailureFromFileThread(const CrxInstallerError& error); | 227 void ReportFailureFromFileThread(const CrxInstallerError& error); |
223 void ReportFailureFromUIThread(const CrxInstallerError& error); | 228 void ReportFailureFromUIThread(const CrxInstallerError& error); |
224 void ReportSuccessFromFileThread(); | 229 void ReportSuccessFromFileThread(); |
225 void ReportSuccessFromUIThread(); | 230 void ReportSuccessFromUIThread(); |
226 void NotifyCrxInstallComplete(const Extension* extension); | 231 void NotifyCrxInstallComplete(const Extension* extension); |
227 | 232 |
| 233 // Runs on File thread. Preload icons if necessary. |
| 234 void PreloadIcons(); |
| 235 |
| 236 // Runs on UI thread. Update extension icon cache with pre-loaded icons. |
| 237 void CachePreloadedIcons(); |
| 238 |
228 // The file we're installing. | 239 // The file we're installing. |
229 FilePath source_file_; | 240 FilePath source_file_; |
230 | 241 |
231 // The URL the file was downloaded from. | 242 // The URL the file was downloaded from. |
232 GURL download_url_; | 243 GURL download_url_; |
233 | 244 |
234 // The directory extensions are installed to. | 245 // The directory extensions are installed to. |
235 FilePath install_directory_; | 246 FilePath install_directory_; |
236 | 247 |
237 // The location the installation came from (bundled with Chromium, registry, | 248 // The location the installation came from (bundled with Chromium, registry, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 363 |
353 // Whether we should produce an error if the manifest declares requirements | 364 // Whether we should produce an error if the manifest declares requirements |
354 // that are not met. If false and there is an unmet requirement, the install | 365 // that are not met. If false and there is an unmet requirement, the install |
355 // will continue but the extension will be distabled. | 366 // will continue but the extension will be distabled. |
356 bool error_on_unsupported_requirements_; | 367 bool error_on_unsupported_requirements_; |
357 | 368 |
358 scoped_ptr<RequirementsChecker> requirements_checker_; | 369 scoped_ptr<RequirementsChecker> requirements_checker_; |
359 | 370 |
360 bool has_requirement_errors_; | 371 bool has_requirement_errors_; |
361 | 372 |
| 373 // Sizes of the icons that need to be pre-loaded. |
| 374 std::set<int> preload_sizes_; |
| 375 |
| 376 // Maps requested preload icon size to loaded icons. |
| 377 std::map<int, SkBitmap> preload_map_; |
| 378 |
362 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 379 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
363 }; | 380 }; |
364 | 381 |
365 } // namespace extensions | 382 } // namespace extensions |
366 | 383 |
367 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 384 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
OLD | NEW |