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

Unified Diff: chrome/browser/extensions/crx_installer.h

Issue 340057: Add first-class support for user scripts (Closed)
Patch Set: newness Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/crx_installer.h
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index a0e50efc74a32fe3fb838a425cd6808a5e9beceb..bd78cf6006c527b8f060bfa4e27c5f5ee01ef576 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -38,7 +38,7 @@ class CrxInstaller :
public SandboxedExtensionUnpackerClient,
public ExtensionInstallUI::Delegate {
public:
- // Starts the installation of the crx file in |crx_path| into
+ // Starts the installation of the crx file in |source_file| into
// |install_directory|.
//
// Other params:
@@ -52,15 +52,25 @@ class CrxInstaller :
// client: Optional. If specified, will be used to confirm installation and
// also notified of success/fail. Note that we hold a reference to
// this, so it can outlive its creator (eg the UI).
- static void Start(const FilePath& crx_path,
+ static void Start(const FilePath& source_file,
const FilePath& install_directory,
Extension::Location install_source,
const std::string& expected_id,
- bool delete_crx,
+ bool delete_source,
bool allow_privilege_increase,
ExtensionsService* frontend,
ExtensionInstallUI* client);
+ // Starts the installation of the user script file in |source_file| into
+ // |install_directory|. The script will be converted to an extension.
+ // See Start() for argument descriptions.
+ static void InstallUserScript(const FilePath& source_file,
+ const GURL& original_url,
+ const FilePath& install_directory,
+ bool delete_source,
+ ExtensionsService* frontend,
+ ExtensionInstallUI* client);
+
// Given the path to the large icon from an extension, read it if present and
// decode it into result.
static void DecodeInstallIcon(const FilePath& large_icon_path,
@@ -71,16 +81,16 @@ class CrxInstaller :
virtual void AbortInstall();
private:
- CrxInstaller(const FilePath& crx_path,
+ CrxInstaller(const FilePath& source_file,
const FilePath& install_directory,
- Extension::Location install_source,
- const std::string& expected_id,
- bool delete_crx,
- bool allow_privilege_increase,
+ bool delete_source,
ExtensionsService* frontend,
ExtensionInstallUI* client);
~CrxInstaller();
+ // Converts the source user script to an extension.
+ void ConvertUserScriptOnFileThread();
+
// SandboxedExtensionUnpackerClient
virtual void OnUnpackFailure(const std::string& error_message);
virtual void OnUnpackSuccess(const FilePath& temp_dir,
@@ -103,8 +113,11 @@ class CrxInstaller :
void ReportSuccessFromFileThread();
void ReportSuccessFromUIThread();
- // The crx file we're installing.
- FilePath crx_path_;
+ // The file we're installing.
+ FilePath source_file_;
+
+ // The URL the file was downloaded from. Only used for user scripts.
+ GURL original_url_;
// The directory extensions are installed to.
FilePath install_directory_;
@@ -123,8 +136,8 @@ class CrxInstaller :
// allowed.
bool extensions_enabled_;
- // Whether we're supposed to delete the source crx file on destruction.
- bool delete_crx_;
+ // Whether we're supposed to delete the source file on destruction.
+ bool delete_source_;
// Whether privileges should be allowed to silently increaes from any
// previously installed version of the extension.

Powered by Google App Engine
This is Rietveld 408576698