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

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

Issue 339103002: Update the EphemeralAppLauncher for use by the webstorePrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self nit Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/webstore_standalone_installer.h
diff --git a/chrome/browser/extensions/webstore_standalone_installer.h b/chrome/browser/extensions/webstore_standalone_installer.h
index 1013fa7eda96a8cb4ecb7973cf6bb36c04d9fbbd..5daa0cc3bb703226647ca577286628b4cd03eba7 100644
--- a/chrome/browser/extensions/webstore_standalone_installer.h
+++ b/chrome/browser/extensions/webstore_standalone_installer.h
@@ -47,6 +47,35 @@ class WebstoreStandaloneInstaller
public WebstoreInstaller::Delegate,
public WebstoreInstallHelper::Delegate {
public:
+ enum InstallResult {
+ // Successful install.
+ INSTALL_SUCCESS,
+ // Unknown error.
+ INSTALL_UNKNOWN_ERROR,
+ // The install was aborted as the requestor is no longer alive.
+ INSTALL_ABORTED,
+ // The installation is not permitted.
+ INSTALL_NOT_PERMITTED,
+ // Invalid Chrome Web Store item ID.
+ INSTALL_INVALID_ID,
+ // Failed to retrieve extension metadata from the Web Store.
+ INSTALL_WEBSTORE_REQUEST_ERROR,
+ // The extension metadata retrieved from the Web Store was invalid.
+ INSTALL_INVALID_WEBSTORE_RESPONSE,
+ // An error occurred while parsing the extension manifest retrieved from the
+ // Web Store.
+ INSTALL_INVALID_MANIFEST,
+ // Failed to retrieve the extension's icon from the Web Store, or the icon
+ // was invalid.
+ INSTALL_ICON_ERROR,
+ // The user cancelled the installation.
+ INSTALL_USER_CANCELLED,
+ // The extension is blacklisted.
+ INSTALL_BLACKLISTED,
+ // Unsatisfied dependencies, such as shared modules.
+ INSTALL_MISSING_DEPENDENCIES
asargent_no_longer_on_chrome 2014/06/18 20:25:10 optional nit: I would personally find the comments
+ };
+
// A callback for when the install process completes, successfully or not. If
// there was a failure, |success| will be false and |error| may contain a
// developer-readable error message about why it failed.
@@ -60,9 +89,19 @@ class WebstoreStandaloneInstaller
protected:
virtual ~WebstoreStandaloneInstaller();
+ // Called when the install should be aborted. The callback is cleared.
void AbortInstall();
- void InvokeCallback(const std::string& error);
- virtual void CompleteInstall(const std::string& error);
+
+ // Called when the install is complete.
+ virtual void CompleteInstall(InstallResult result, const std::string& error);
+
+ // Called when the installer should proceed to prompt the user.
+ void ProceedWithInstallPrompt();
+
+ // Lazily creates a dummy extension for display from the parsed manifest. This
+ // is safe to call from OnManifestParsed() onwards. The manifest may be
+ // invalid, thus the caller must check that the return value is not NULL.
+ scoped_refptr<const Extension> GetLocalizedExtensionForDisplay();
// Template Method's hooks to be implemented by subclasses.
@@ -108,11 +147,12 @@ class WebstoreStandaloneInstaller
const base::DictionaryValue& webstore_data,
std::string* error) const = 0;
- // Perform all necessary checks after the manifest has been parsed to make
- // sure that the install should still proceed.
- virtual bool CheckInstallValid(
- const base::DictionaryValue& manifest,
- std::string* error);
+ // Will be called after the extension's manifest has been successfully parsed.
+ // Subclasses can perform asynchronous checks at this point and call
+ // ProceedWithInstallPrompt() to proceed with the install or otherwise call
+ // CompleteInstall() with an error code. The default implementation calls
+ // ProceedWithInstallPrompt().
+ virtual void OnManifestParsed();
// Returns an install UI to be shown. By default, this returns an install UI
// that is a transient child of the host window for GetWebContents().
@@ -137,6 +177,9 @@ class WebstoreStandaloneInstaller
Profile* profile() const { return profile_; }
const std::string& id() const { return id_; }
const base::DictionaryValue* manifest() const { return manifest_.get(); }
+ const Extension* localized_extension_for_display() const {
+ return localized_extension_for_display_.get();
+ }
private:
friend class base::RefCountedThreadSafe<WebstoreStandaloneInstaller>;

Powered by Google App Engine
This is Rietveld 408576698