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

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

Issue 2783143005: Replace ExtensionInstallChecker with generic PreloadCheckGroup (Closed)
Patch Set: fix debug build 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_UNPACKED_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_UNPACKED_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/bind.h" 12 #include "base/bind.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 "extensions/browser/preload_check.h"
17 18
18 class ExtensionService; 19 class ExtensionService;
19 class Profile; 20 class Profile;
20 21
21 namespace extensions { 22 namespace extensions {
22 23
23 class Extension; 24 class Extension;
24 class ExtensionInstallChecker; 25 class PreloadCheckGroup;
25 26
26 // Installs and loads an unpacked extension. Because internal state needs to be 27 // Installs and loads an unpacked extension. Because internal state needs to be
27 // held about the instalation process, only one call to Load*() should be made 28 // held about the instalation process, only one call to Load*() should be made
28 // per UnpackedInstaller. 29 // per UnpackedInstaller.
29 // TODO(erikkay): It might be useful to be able to load a packed extension 30 // TODO(erikkay): It might be useful to be able to load a packed extension
30 // (presumably into memory) without installing it. 31 // (presumably into memory) without installing it.
31 class UnpackedInstaller 32 class UnpackedInstaller
32 : public base::RefCountedThreadSafe<UnpackedInstaller> { 33 : public base::RefCountedThreadSafe<UnpackedInstaller> {
33 public: 34 public:
34 using CompletionCallback = base::Callback<void(const Extension* extension, 35 using CompletionCallback = base::Callback<void(const Extension* extension,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 83
83 explicit UnpackedInstaller(ExtensionService* extension_service); 84 explicit UnpackedInstaller(ExtensionService* extension_service);
84 virtual ~UnpackedInstaller(); 85 virtual ~UnpackedInstaller();
85 86
86 // Must be called from the UI thread. 87 // Must be called from the UI thread.
87 void ShowInstallPrompt(); 88 void ShowInstallPrompt();
88 89
89 // Begin management policy and requirements checks. 90 // Begin management policy and requirements checks.
90 void StartInstallChecks(); 91 void StartInstallChecks();
91 92
92 // Callback from ExtensionInstallChecker. 93 // Callback from PreloadCheckGroup.
93 void OnInstallChecksComplete(int failed_checks); 94 void OnInstallChecksComplete(PreloadCheck::Errors errors);
94 95
95 // Verifies if loading unpacked extensions is allowed. 96 // Verifies if loading unpacked extensions is allowed.
96 bool IsLoadingUnpackedAllowed() const; 97 bool IsLoadingUnpackedAllowed() const;
97 98
98 // We change the input extension path to an absolute path, on the file thread. 99 // We change the input extension path to an absolute path, on the file thread.
99 // Then we need to check the file access preference, which needs 100 // Then we need to check the file access preference, which needs
100 // to happen back on the UI thread, so it posts CheckExtensionFileAccess on 101 // to happen back on the UI thread, so it posts CheckExtensionFileAccess on
101 // the UI thread. In turn, once that gets the pref, it goes back to the 102 // the UI thread. In turn, once that gets the pref, it goes back to the
102 // file thread with LoadWithFileAccess. 103 // file thread with LoadWithFileAccess.
103 // TODO(yoz): It would be nice to remove this ping-pong, but we need to know 104 // TODO(yoz): It would be nice to remove this ping-pong, but we need to know
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // loading. 138 // loading.
138 bool prompt_for_plugins_; 139 bool prompt_for_plugins_;
139 140
140 // Whether to require the extension installed to have a modern manifest 141 // Whether to require the extension installed to have a modern manifest
141 // version. 142 // version.
142 bool require_modern_manifest_version_; 143 bool require_modern_manifest_version_;
143 144
144 // Whether or not to be noisy (show a dialog) on failure. Defaults to true. 145 // Whether or not to be noisy (show a dialog) on failure. Defaults to true.
145 bool be_noisy_on_failure_; 146 bool be_noisy_on_failure_;
146 147
147 // Checks management policies and requirements before the extension can be 148 // Checks to run before the extension can be installed.
148 // installed. 149 std::unique_ptr<PreloadCheck> policy_check_;
149 std::unique_ptr<ExtensionInstallChecker> install_checker_; 150 std::unique_ptr<PreloadCheck> requirements_check_;
151
152 // Runs the above checks.
153 std::unique_ptr<PreloadCheckGroup> check_group_;
150 154
151 CompletionCallback callback_; 155 CompletionCallback callback_;
152 156
153 DISALLOW_COPY_AND_ASSIGN(UnpackedInstaller); 157 DISALLOW_COPY_AND_ASSIGN(UnpackedInstaller);
154 }; 158 };
155 159
156 } // namespace extensions 160 } // namespace extensions
157 161
158 #endif // CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_ 162 #endif // CHROME_BROWSER_EXTENSIONS_UNPACKED_INSTALLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_checker_unittest.cc ('k') | chrome/browser/extensions/unpacked_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698