Index: chrome/browser/extensions/extension_webstore_private_api.h |
diff --git a/chrome/browser/extensions/extension_webstore_private_api.h b/chrome/browser/extensions/extension_webstore_private_api.h |
index f1021e1955e74bb6f33b3b5b862f9fd80143f315..411441cec2e445e4bc01371057518c3860c4b900 100644 |
--- a/chrome/browser/extensions/extension_webstore_private_api.h |
+++ b/chrome/browser/extensions/extension_webstore_private_api.h |
@@ -10,6 +10,7 @@ |
#include "chrome/browser/extensions/extension_function.h" |
#include "chrome/browser/extensions/extension_install_ui.h" |
+#include "chrome/browser/extensions/webstore_bundle.h" |
#include "chrome/browser/extensions/webstore_install_helper.h" |
#include "chrome/browser/extensions/webstore_installer.h" |
#include "chrome/common/net/gaia/google_service_auth_error.h" |
@@ -29,6 +30,47 @@ class WebstorePrivateApi { |
WebstoreInstaller::Delegate* delegate); |
}; |
+class InstallBundleFunction : public AsyncExtensionFunction, |
+ public WebstoreBundle::Delegate { |
+ public: |
+ InstallBundleFunction(); |
+ |
+ // Result codes for the return value. If you change this, make sure to |
+ // update the description for the beginInstallBundle callback in |
+ // extension_api.json. |
+ enum ErrorCode { |
+ ERROR_NONE = 0, |
+ |
+ // An unspecified error occurred. |
+ UNKNOWN_ERROR, |
+ |
+ // The user cancelled the confirmation dialog instead of accepting it. |
+ USER_CANCELLED, |
+ |
+ // The page does not have permission to call this function. |
+ PERMISSION_DENIED, |
+ }; |
+ |
+ virtual void OnBundleInstallApproved() OVERRIDE; |
+ virtual void OnBundleInstallCanceled(bool user_initiated) OVERRIDE; |
+ virtual void OnBundleInstallCompleted() OVERRIDE; |
+ |
+ protected: |
+ virtual ~InstallBundleFunction(); |
+ virtual bool RunImpl() OVERRIDE; |
+ |
+ // Reads the extension details from |extensions| into |items|. |
+ bool ReadBundleInfo(base::ListValue* extensions, |
+ WebstoreBundle::ItemList* items); |
+ |
+ // Sets the result_ as a string based on |code|. |
+ void SetResult(ErrorCode code); |
+ |
+ private: |
+ scoped_refptr<WebstoreBundle> bundle_; |
+ DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.installBundle"); |
+}; |
+ |
class BeginInstallWithManifestFunction |
: public AsyncExtensionFunction, |
public ExtensionInstallUI::Delegate, |