| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/version.h" | 15 #include "base/version.h" |
| 16 #include "chrome/browser/extensions/crx_installer_error.h" |
| 16 #include "chrome/browser/extensions/extension_install_prompt.h" | 17 #include "chrome/browser/extensions/extension_install_prompt.h" |
| 17 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" | 18 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" |
| 18 #include "chrome/browser/extensions/webstore_installer.h" | 19 #include "chrome/browser/extensions/webstore_installer.h" |
| 19 #include "chrome/common/extensions/extension.h" | 20 #include "chrome/common/extensions/extension.h" |
| 20 #include "chrome/common/string_ordinal.h" | 21 #include "chrome/common/string_ordinal.h" |
| 21 #include "chrome/common/web_apps.h" | 22 #include "chrome/common/web_apps.h" |
| 22 | 23 |
| 23 class ExtensionService; | 24 class ExtensionService; |
| 24 class SkBitmap; | 25 class SkBitmap; |
| 25 | 26 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 virtual ~CrxInstaller(); | 180 virtual ~CrxInstaller(); |
| 180 | 181 |
| 181 // Converts the source user script to an extension. | 182 // Converts the source user script to an extension. |
| 182 void ConvertUserScriptOnFileThread(); | 183 void ConvertUserScriptOnFileThread(); |
| 183 | 184 |
| 184 // Converts the source web app to an extension. | 185 // Converts the source web app to an extension. |
| 185 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app); | 186 void ConvertWebAppOnFileThread(const WebApplicationInfo& web_app); |
| 186 | 187 |
| 187 // Called after OnUnpackSuccess as a last check to see whether the install | 188 // Called after OnUnpackSuccess as a last check to see whether the install |
| 188 // should complete. | 189 // should complete. |
| 189 bool AllowInstall(const extensions::Extension* extension, string16* error); | 190 CrxInstallerError AllowInstall(const extensions::Extension* extension); |
| 190 | 191 |
| 191 // SandboxedExtensionUnpackerClient | 192 // SandboxedExtensionUnpackerClient |
| 192 virtual void OnUnpackFailure(const string16& error_message) OVERRIDE; | 193 virtual void OnUnpackFailure(const string16& error_message) OVERRIDE; |
| 193 virtual void OnUnpackSuccess(const FilePath& temp_dir, | 194 virtual void OnUnpackSuccess(const FilePath& temp_dir, |
| 194 const FilePath& extension_dir, | 195 const FilePath& extension_dir, |
| 195 const base::DictionaryValue* original_manifest, | 196 const base::DictionaryValue* original_manifest, |
| 196 const extensions::Extension* extension) OVERRIDE; | 197 const extensions::Extension* extension) OVERRIDE; |
| 197 | 198 |
| 198 // Returns true if we can skip confirmation because the install was | 199 // Returns true if we can skip confirmation because the install was |
| 199 // whitelisted. | 200 // whitelisted. |
| 200 bool CanSkipConfirmation(); | 201 bool CanSkipConfirmation(); |
| 201 | 202 |
| 202 // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) | 203 // Runs on the UI thread. Confirms with the user (via ExtensionInstallPrompt) |
| 203 // that it is OK to install this extension. | 204 // that it is OK to install this extension. |
| 204 void ConfirmInstall(); | 205 void ConfirmInstall(); |
| 205 | 206 |
| 206 // Runs on File thread. Install the unpacked extension into the profile and | 207 // Runs on File thread. Install the unpacked extension into the profile and |
| 207 // notify the frontend. | 208 // notify the frontend. |
| 208 void CompleteInstall(); | 209 void CompleteInstall(); |
| 209 | 210 |
| 210 // Result reporting. | 211 // Result reporting. |
| 211 void ReportFailureFromFileThread(const string16& error); | 212 void ReportFailureFromFileThread(const CrxInstallerError& error); |
| 212 void ReportFailureFromUIThread(const string16& error); | 213 void ReportFailureFromUIThread(const CrxInstallerError& error); |
| 213 void ReportSuccessFromFileThread(); | 214 void ReportSuccessFromFileThread(); |
| 214 void ReportSuccessFromUIThread(); | 215 void ReportSuccessFromUIThread(); |
| 215 void NotifyCrxInstallComplete(const extensions::Extension* extension); | 216 void NotifyCrxInstallComplete(const extensions::Extension* extension); |
| 216 | 217 |
| 217 // The file we're installing. | 218 // The file we're installing. |
| 218 FilePath source_file_; | 219 FilePath source_file_; |
| 219 | 220 |
| 220 // The URL the file was downloaded from. | 221 // The URL the file was downloaded from. |
| 221 GURL download_url_; | 222 GURL download_url_; |
| 222 | 223 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // indicate to the client whether the file should be removed and any UI | 334 // indicate to the client whether the file should be removed and any UI |
| 334 // initiating the installation can be removed. This is different than whether | 335 // initiating the installation can be removed. This is different than whether |
| 335 // there was an error; if there was an error that rejects installation we | 336 // there was an error; if there was an error that rejects installation we |
| 336 // still consider the installation 'handled'. | 337 // still consider the installation 'handled'. |
| 337 bool did_handle_successfully_; | 338 bool did_handle_successfully_; |
| 338 | 339 |
| 339 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); | 340 DISALLOW_COPY_AND_ASSIGN(CrxInstaller); |
| 340 }; | 341 }; |
| 341 | 342 |
| 342 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ | 343 #endif // CHROME_BROWSER_EXTENSIONS_CRX_INSTALLER_H_ |
| OLD | NEW |