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

Side by Side Diff: chrome/browser/extensions/crx_installer.h

Issue 2783143005: Replace ExtensionInstallChecker with generic PreloadCheckGroup (Closed)
Patch Set: cleanup Created 3 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_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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/version.h" 17 #include "base/version.h"
18 #include "chrome/browser/extensions/extension_install_prompt.h" 18 #include "chrome/browser/extensions/extension_install_prompt.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/webstore_installer.h" 20 #include "chrome/browser/extensions/webstore_installer.h"
21 #include "chrome/common/extensions/extension_constants.h" 21 #include "chrome/common/extensions/extension_constants.h"
22 #include "components/sync/model/string_ordinal.h" 22 #include "components/sync/model/string_ordinal.h"
23 #include "extensions/browser/install_flag.h" 23 #include "extensions/browser/install_flag.h"
24 #include "extensions/browser/preload_check.h"
24 #include "extensions/browser/sandboxed_unpacker.h" 25 #include "extensions/browser/sandboxed_unpacker.h"
25 #include "extensions/common/extension.h" 26 #include "extensions/common/extension.h"
26 #include "extensions/common/manifest.h" 27 #include "extensions/common/manifest.h"
27 28
28 class ExtensionService; 29 class ExtensionService;
29 class ExtensionServiceTest; 30 class ExtensionServiceTest;
30 class SkBitmap; 31 class SkBitmap;
31 struct WebApplicationInfo; 32 struct WebApplicationInfo;
32 33
33 namespace base { 34 namespace base {
34 class SequencedTaskRunner; 35 class SequencedTaskRunner;
35 } 36 }
36 37
37 namespace extensions { 38 namespace extensions {
38 class CrxInstallError; 39 class CrxInstallError;
39 class ExtensionInstallChecker;
40 class ExtensionUpdaterTest; 40 class ExtensionUpdaterTest;
41 class PreloadCheckGroup;
41 42
42 // This class installs a crx file into a profile. 43 // This class installs a crx file into a profile.
43 // 44 //
44 // Installing a CRX is a multi-step process, including unpacking the crx, 45 // Installing a CRX is a multi-step process, including unpacking the crx,
45 // validating it, prompting the user, and installing. Since many of these 46 // validating it, prompting the user, and installing. Since many of these
46 // steps must occur on the file thread, this class contains a copy of all data 47 // steps must occur on the file thread, this class contains a copy of all data
47 // necessary to do its job. (This also minimizes external dependencies for 48 // necessary to do its job. (This also minimizes external dependencies for
48 // easier testing). 49 // easier testing).
49 // 50 //
50 // Lifetime management: 51 // Lifetime management:
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void OnUnpackSuccess(const base::FilePath& temp_dir, 234 void OnUnpackSuccess(const base::FilePath& temp_dir,
234 const base::FilePath& extension_dir, 235 const base::FilePath& extension_dir,
235 std::unique_ptr<base::DictionaryValue> original_manifest, 236 std::unique_ptr<base::DictionaryValue> original_manifest,
236 const Extension* extension, 237 const Extension* extension,
237 const SkBitmap& install_icon) override; 238 const SkBitmap& install_icon) override;
238 239
239 // Called on the UI thread to start the requirements, policy and blacklist 240 // Called on the UI thread to start the requirements, policy and blacklist
240 // checks on the extension. 241 // checks on the extension.
241 void CheckInstall(); 242 void CheckInstall();
242 243
243 // Runs on the UI thread. Callback from ExtensionInstallChecker. 244 // Runs on the UI thread. Callback from PreloadCheckGroup.
244 void OnInstallChecksComplete(int failed_checks); 245 void OnInstallChecksComplete(PreloadCheck::Errors errors);
245 246
246 // Runs on the UI thread. Confirms the installation to the ExtensionService. 247 // Runs on the UI thread. Confirms the installation to the ExtensionService.
247 void ConfirmInstall(); 248 void ConfirmInstall();
248 249
249 // Runs on the UI thread. Updates the creation flags for the extension and 250 // Runs on the UI thread. Updates the creation flags for the extension and
250 // calls CompleteInstall(). 251 // calls CompleteInstall().
251 void UpdateCreationFlagsAndCompleteInstall(); 252 void UpdateCreationFlagsAndCompleteInstall();
252 253
253 // Runs on File thread. Install the unpacked extension into the profile and 254 // Runs on File thread. Install the unpacked extension into the profile and
254 // notify the frontend. 255 // notify the frontend.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // Used to show the install dialog. 433 // Used to show the install dialog.
433 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; 434 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_;
434 435
435 // Whether the update is initiated by the user from the extension settings 436 // Whether the update is initiated by the user from the extension settings
436 // page. 437 // page.
437 bool update_from_settings_page_; 438 bool update_from_settings_page_;
438 439
439 // The flags for ExtensionService::OnExtensionInstalled. 440 // The flags for ExtensionService::OnExtensionInstalled.
440 int install_flags_; 441 int install_flags_;
441 442
442 // Performs requirements, policy and blacklist checks on the extension. 443 // Checks that may run before installing the extension.
443 std::unique_ptr<ExtensionInstallChecker> install_checker_; 444 std::unique_ptr<PreloadCheck> policy_check_;
445 std::unique_ptr<PreloadCheck> requirements_check_;
446 std::unique_ptr<PreloadCheck> blacklist_check_;
447
448 // Runs the above checks.
449 std::unique_ptr<PreloadCheckGroup> check_group_;
444 450
445 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); 451 DISALLOW_COPY_AND_ASSIGN(CrxInstaller);
446 }; 452 };
447 453
448 } // namespace extensions 454 } // namespace extensions
449 455
450 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ 456 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698