Index: chrome/browser/extensions/api/webstore_private/webstore_private_api.h |
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h |
index e61cdb0fef8c4bc3f69864e28c3b7670f79fe59c..cb8f2f9883ccbb06311f4f65287edc8e19dcd10c 100644 |
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h |
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h |
@@ -158,6 +158,82 @@ class WebstorePrivateCompleteInstallFunction |
void OnInstallSuccess(const std::string& id); |
}; |
+class WebstorePrivateShowPermissionPromptForDelegatedInstallFunction |
+ : public ChromeAsyncExtensionFunction, |
+ public ExtensionInstallPrompt::Delegate, |
+ public WebstoreInstallHelper::Delegate { |
+ public: |
+ DECLARE_EXTENSION_FUNCTION( |
+ "webstorePrivate.showPermissionPromptForDelegatedInstall", |
+ WEBSTOREPRIVATE_SHOWPERMISSIONPROMPTFORDELEGATEDINSTALL) |
+ |
+ // Result codes for the return value. If you change this, make sure to |
+ // update the description for the showPermissionPromptForDelegatedInstall |
+ // callback in the extension API JSON. |
+ enum ResultCode { |
+ ERROR_NONE = 0, |
not at google - send to devlin
2015/02/04 21:28:29
We should just formalise this as an enum in the sc
Marc Treib
2015/02/05 10:33:37
Okay, that makes sense. I'll do that in a separate
|
+ |
+ // An unspecified error occurred. |
+ UNKNOWN_ERROR, |
+ |
+ // The user cancelled the confirmation dialog instead of accepting it. |
+ USER_CANCELLED, |
+ |
+ // The manifest failed to parse correctly. |
+ MANIFEST_ERROR, |
+ |
+ // There was a problem parsing the base64 encoded icon data. |
+ ICON_ERROR, |
+ |
+ // The extension id was invalid. |
+ INVALID_ID, |
+ |
+ // Invalid icon url. |
+ INVALID_ICON_URL, |
+ }; |
+ |
+ WebstorePrivateShowPermissionPromptForDelegatedInstallFunction(); |
+ |
+ // WebstoreInstallHelper::Delegate: |
not at google - send to devlin
2015/02/04 21:28:29
All these delegate methods can be private, right?
Marc Treib
2015/02/05 10:33:37
Indeed they can; I just mimicked what all the othe
|
+ void OnWebstoreParseSuccess(const std::string& id, |
+ const SkBitmap& icon, |
+ base::DictionaryValue* parsed_manifest) override; |
+ void OnWebstoreParseFailure(const std::string& id, |
+ InstallHelperResultCode result_code, |
+ const std::string& error_message) override; |
+ |
+ // ExtensionInstallPrompt::Delegate: |
+ void InstallUIProceed() override; |
+ void InstallUIAbort(bool user_initiated) override; |
+ |
+ protected: |
+ ~WebstorePrivateShowPermissionPromptForDelegatedInstallFunction() override; |
+ |
+ // ExtensionFunction: |
+ bool RunAsync() override; |
not at google - send to devlin
2015/02/04 21:28:29
Override Run() not RunAsync().
This will also let
Marc Treib
2015/02/05 10:33:37
This also applies to all the other WebstorePrivate
|
+ |
+ // Sets the result_ as a string based on |code|. |
+ void SetResultCode(ResultCode code); |
+ |
+ private: |
+ const char* ResultCodeToString(ResultCode code); |
+ |
+ // These store the input parameters to the function. |
+ scoped_ptr<api::webstore_private::ShowPermissionPromptForDelegatedInstall:: |
+ Params> params_; |
+ |
+ // The results of parsing manifest_ and icon_data_ go into these two. |
+ scoped_ptr<base::DictionaryValue> parsed_manifest_; |
+ SkBitmap icon_; |
+ |
+ // A dummy Extension object we create for the purposes of using |
+ // ExtensionInstallPrompt to prompt for confirmation of the install. |
+ scoped_refptr<extensions::Extension> dummy_extension_; |
not at google - send to devlin
2015/02/04 21:28:29
This file is already in the extensions:: namespace
Marc Treib
2015/02/05 10:33:37
Done.
|
+ |
+ // The class that displays the install prompt. |
+ scoped_ptr<ExtensionInstallPrompt> install_prompt_; |
+}; |
+ |
class WebstorePrivateEnableAppLauncherFunction |
: public ChromeSyncExtensionFunction { |
public: |