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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class SkBitmap; | 24 class SkBitmap; |
25 | 25 |
26 namespace extensions { | 26 namespace extensions { |
27 class ExtensionUpdaterTest; | 27 class ExtensionUpdaterTest; |
28 class RequirementsChecker; | 28 class RequirementsChecker; |
29 | 29 |
30 // This class installs a crx file into a profile. | 30 // This class installs a crx file into a profile. |
31 // | 31 // |
32 // Installing a CRX is a multi-step process, including unpacking the crx, | 32 // Installing a CRX is a multi-step process, including unpacking the crx, |
33 // validating it, prompting the user, and installing. Since many of these | 33 // validating it, prompting the user, and installing. Since many of these |
34 // steps must occur on the file thread, this class contains a copy of all data | 34 // steps must occur on the FILE thread, this class contains a copy of all data |
35 // necessary to do its job. (This also minimizes external dependencies for | 35 // necessary to do its job. (This also minimizes external dependencies for |
36 // easier testing). | 36 // easier testing). |
37 // | 37 // |
38 // Lifetime management: | 38 // Lifetime management: |
39 // | 39 // |
40 // This class is ref-counted by each call it makes to itself on another thread, | 40 // This class is ref-counted by each call it makes to itself on another thread, |
41 // and by UtilityProcessHost. | 41 // and by UtilityProcessHost. |
42 // | 42 // |
43 // Additionally, we hold a reference to our own client so that it lives at least | 43 // Additionally, we hold a reference to our own client so that it lives at least |
44 // long enough to receive the result of unpacking. | 44 // long enough to receive the result of unpacking. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Called on the UI thread to start the requirements check on the extension. | 207 // Called on the UI thread to start the requirements check on the extension. |
208 void CheckRequirements(); | 208 void CheckRequirements(); |
209 | 209 |
210 // Runs on the UI thread. Callback from RequirementsChecker. | 210 // Runs on the UI thread. Callback from RequirementsChecker. |
211 void OnRequirementsChecked(std::vector<std::string> requirement_errors); | 211 void OnRequirementsChecked(std::vector<std::string> requirement_errors); |
212 | 212 |
213 // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) | 213 // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) |
214 // that it is OK to install this extension. | 214 // that it is OK to install this extension. |
215 void ConfirmInstall(); | 215 void ConfirmInstall(); |
216 | 216 |
217 // Runs on File thread. Install the unpacked extension into the profile and | 217 // Runs on FILE thread. Ensures that app is not downgraded. If App Host is |
218 // notify the frontend. | 218 // not installed, calls installer and posts OnAppHostInstallationComplete() |
| 219 // as call back. Else proceeds to CompleteInstall(). |
| 220 void BeginInstall(); |
| 221 |
| 222 // Runs on FILE thread. Callback function for AppHostInstaller. |
| 223 // If not |success|, shows error message. Else proceeds to CompleteInstall(). |
| 224 void OnAppHostInstallationComplete(bool success); |
| 225 |
| 226 // Runs on FILE thread. Installs the unpacked extension into the profile and |
| 227 // notifies the frontend. |
219 void CompleteInstall(); | 228 void CompleteInstall(); |
220 | 229 |
221 // Result reporting. | 230 // Result reporting. |
222 void ReportFailureFromFileThread(const CrxInstallerError& error); | 231 void ReportFailureFromFileThread(const CrxInstallerError& error); |
223 void ReportFailureFromUIThread(const CrxInstallerError& error); | 232 void ReportFailureFromUIThread(const CrxInstallerError& error); |
224 void ReportSuccessFromFileThread(); | 233 void ReportSuccessFromFileThread(); |
225 void ReportSuccessFromUIThread(); | 234 void ReportSuccessFromUIThread(); |
226 void NotifyCrxInstallComplete(const Extension* extension); | 235 void NotifyCrxInstallComplete(const Extension* extension); |
227 | 236 |
228 // The file we're installing. | 237 // The file we're installing. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 FilePath temp_dir_; | 308 FilePath temp_dir_; |
300 | 309 |
301 // The frontend we will report results back to. | 310 // The frontend we will report results back to. |
302 base::WeakPtr<ExtensionService> frontend_weak_; | 311 base::WeakPtr<ExtensionService> frontend_weak_; |
303 | 312 |
304 // The Profile where the extension is being installed in. | 313 // The Profile where the extension is being installed in. |
305 Profile* profile_; | 314 Profile* profile_; |
306 | 315 |
307 // The client we will work with to do the installation. This can be NULL, in | 316 // The client we will work with to do the installation. This can be NULL, in |
308 // which case the install is silent. | 317 // which case the install is silent. |
309 // NOTE: we may be deleted on the file thread. To ensure the UI is deleted on | 318 // NOTE: we may be deleted on the FILE thread. To ensure the UI is deleted on |
310 // the main thread we don't use a scoped_ptr here. | 319 // the main thread we don't use a scoped_ptr here. |
311 ExtensionInstallPrompt* client_; | 320 ExtensionInstallPrompt* client_; |
312 | 321 |
313 // The root of the unpacked extension directory. This is a subdirectory of | 322 // The root of the unpacked extension directory. This is a subdirectory of |
314 // temp_dir_, so we don't have to delete it explicitly. | 323 // temp_dir_, so we don't have to delete it explicitly. |
315 FilePath unpacked_extension_root_; | 324 FilePath unpacked_extension_root_; |
316 | 325 |
317 // True when the CRX being installed was just downloaded. | 326 // True when the CRX being installed was just downloaded. |
318 // Used to trigger extra checks before installing. | 327 // Used to trigger extra checks before installing. |
319 bool apps_require_extension_mime_type_; | 328 bool apps_require_extension_mime_type_; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 scoped_ptr<RequirementsChecker> requirements_checker_; | 367 scoped_ptr<RequirementsChecker> requirements_checker_; |
359 | 368 |
360 bool has_requirement_errors_; | 369 bool has_requirement_errors_; |
361 | 370 |
362 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 371 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
363 }; | 372 }; |
364 | 373 |
365 } // namespace extensions | 374 } // namespace extensions |
366 | 375 |
367 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 376 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
OLD | NEW |