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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Called on the UI thread to start the requirements check on the extension. | 213 // Called on the UI thread to start the requirements check on the extension. |
214 void CheckRequirements(); | 214 void CheckRequirements(); |
215 | 215 |
216 // Runs on the UI thread. Callback from RequirementsChecker. | 216 // Runs on the UI thread. Callback from RequirementsChecker. |
217 void OnRequirementsChecked(std::vector<std::string> requirement_errors); | 217 void OnRequirementsChecked(std::vector<std::string> requirement_errors); |
218 | 218 |
219 // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) | 219 // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) |
220 // that it is OK to install this extension. | 220 // that it is OK to install this extension. |
221 void ConfirmInstall(); | 221 void ConfirmInstall(); |
222 | 222 |
223 // Runs on File thread. Install the unpacked extension into the profile and | 223 // Runs on FILE thread. Ensures that app is not downgraded. If App Host is |
224 // notify the frontend. | 224 // not installed, calls installer and posts OnAppHostInstallationComplete() |
| 225 // as call back. Else proceeds to CompleteInstall(). |
| 226 void BeginInstall(); |
| 227 |
| 228 // Runs on FILE thread. Callback function for AppHostInstaller. |
| 229 // If not |success|, shows error message. Else proceeds to CompleteInstall(). |
| 230 void OnAppHostInstallationComplete(bool success); |
| 231 |
| 232 // Runs on FILE thread. Installs the unpacked extension into the profile and |
| 233 // notifies the frontend. |
225 void CompleteInstall(); | 234 void CompleteInstall(); |
226 | 235 |
227 // Result reporting. | 236 // Result reporting. |
228 void ReportFailureFromFileThread(const CrxInstallerError& error); | 237 void ReportFailureFromFileThread(const CrxInstallerError& error); |
229 void ReportFailureFromUIThread(const CrxInstallerError& error); | 238 void ReportFailureFromUIThread(const CrxInstallerError& error); |
230 void ReportSuccessFromFileThread(); | 239 void ReportSuccessFromFileThread(); |
231 void ReportSuccessFromUIThread(); | 240 void ReportSuccessFromUIThread(); |
232 void NotifyCrxInstallComplete(const Extension* extension); | 241 void NotifyCrxInstallComplete(const Extension* extension); |
233 | 242 |
234 // The file we're installing. | 243 // The file we're installing. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 FilePath temp_dir_; | 314 FilePath temp_dir_; |
306 | 315 |
307 // The frontend we will report results back to. | 316 // The frontend we will report results back to. |
308 base::WeakPtr<ExtensionService> frontend_weak_; | 317 base::WeakPtr<ExtensionService> frontend_weak_; |
309 | 318 |
310 // The Profile where the extension is being installed in. | 319 // The Profile where the extension is being installed in. |
311 Profile* profile_; | 320 Profile* profile_; |
312 | 321 |
313 // The client we will work with to do the installation. This can be NULL, in | 322 // The client we will work with to do the installation. This can be NULL, in |
314 // which case the install is silent. | 323 // which case the install is silent. |
315 // NOTE: we may be deleted on the file thread. To ensure the UI is deleted on | 324 // NOTE: we may be deleted on the FILE thread. To ensure the UI is deleted on |
316 // the main thread we don't use a scoped_ptr here. | 325 // the main thread we don't use a scoped_ptr here. |
317 ExtensionInstallPrompt* client_; | 326 ExtensionInstallPrompt* client_; |
318 | 327 |
319 // The root of the unpacked extension directory. This is a subdirectory of | 328 // The root of the unpacked extension directory. This is a subdirectory of |
320 // temp_dir_, so we don't have to delete it explicitly. | 329 // temp_dir_, so we don't have to delete it explicitly. |
321 FilePath unpacked_extension_root_; | 330 FilePath unpacked_extension_root_; |
322 | 331 |
323 // True when the CRX being installed was just downloaded. | 332 // True when the CRX being installed was just downloaded. |
324 // Used to trigger extra checks before installing. | 333 // Used to trigger extra checks before installing. |
325 bool apps_require_extension_mime_type_; | 334 bool apps_require_extension_mime_type_; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 376 |
368 // Used to show the install dialog. | 377 // Used to show the install dialog. |
369 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; | 378 ExtensionInstallPrompt::ShowDialogCallback show_dialog_callback_; |
370 | 379 |
371 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 380 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
372 }; | 381 }; |
373 | 382 |
374 } // namespace extensions | 383 } // namespace extensions |
375 | 384 |
376 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 385 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
OLD | NEW |