Remove chrome.webstorePrivate.installBundle() part 1
BUG=243879
TEST=None
R=asargent
Review URL: https://codereview.chromium.org/673263003
Cr-Commit-Position: refs/heads/master@{#301248}
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
index b33e91c6..dad5c31c 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -30,7 +30,6 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
#include "chrome/browser/ui/app_list/app_list_util.h"
-#include "chrome/browser/ui/browser.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "components/crx_file/id_util.h"
@@ -60,7 +59,6 @@
namespace GetIsLauncherEnabled = api::webstore_private::GetIsLauncherEnabled;
namespace GetStoreLogin = api::webstore_private::GetStoreLogin;
namespace GetWebGLStatus = api::webstore_private::GetWebGLStatus;
-namespace InstallBundle = api::webstore_private::InstallBundle;
namespace IsInIncognitoMode = api::webstore_private::IsInIncognitoMode;
namespace LaunchEphemeralApp = api::webstore_private::LaunchEphemeralApp;
namespace LaunchEphemeralAppResult = LaunchEphemeralApp::Results;
@@ -164,64 +162,6 @@
return g_pending_approvals.Get().PopApproval(profile, extension_id);
}
-WebstorePrivateInstallBundleFunction::WebstorePrivateInstallBundleFunction() {}
-WebstorePrivateInstallBundleFunction::~WebstorePrivateInstallBundleFunction() {}
-
-bool WebstorePrivateInstallBundleFunction::RunAsync() {
- scoped_ptr<InstallBundle::Params> params(
- InstallBundle::Params::Create(*args_));
- EXTENSION_FUNCTION_VALIDATE(params);
-
- BundleInstaller::ItemList items;
- if (!ReadBundleInfo(*params, &items))
- return false;
-
- bundle_ = new BundleInstaller(GetCurrentBrowser(), items);
-
- AddRef(); // Balanced in OnBundleInstallCompleted / OnBundleInstallCanceled.
-
- bundle_->PromptForApproval(this);
- return true;
-}
-
-bool WebstorePrivateInstallBundleFunction::
- ReadBundleInfo(const InstallBundle::Params& params,
- BundleInstaller::ItemList* items) {
- for (size_t i = 0; i < params.details.size(); ++i) {
- BundleInstaller::Item item;
- item.id = params.details[i]->id;
- item.manifest = params.details[i]->manifest;
- item.localized_name = params.details[i]->localized_name;
- items->push_back(item);
- }
-
- return true;
-}
-
-void WebstorePrivateInstallBundleFunction::OnBundleInstallApproved() {
- bundle_->CompleteInstall(
- dispatcher()->delegate()->GetAssociatedWebContents(),
- this);
-}
-
-void WebstorePrivateInstallBundleFunction::OnBundleInstallCanceled(
- bool user_initiated) {
- if (user_initiated)
- error_ = "user_canceled";
- else
- error_ = "unknown_error";
-
- SendResponse(false);
-
- Release(); // Balanced in RunAsync().
-}
-
-void WebstorePrivateInstallBundleFunction::OnBundleInstallCompleted() {
- SendResponse(true);
-
- Release(); // Balanced in RunAsync().
-}
-
WebstorePrivateBeginInstallWithManifest3Function::
WebstorePrivateBeginInstallWithManifest3Function() {
}
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 7bad7c7..e61cdb0 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.h
@@ -8,7 +8,6 @@
#include <string>
#include "chrome/browser/extensions/active_install_data.h"
-#include "chrome/browser/extensions/bundle_installer.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/webstore_install_helper.h"
@@ -44,35 +43,6 @@
Profile* profile, const std::string& extension_id);
};
-class WebstorePrivateInstallBundleFunction
- : public ChromeAsyncExtensionFunction,
- public extensions::BundleInstaller::Delegate {
- public:
- DECLARE_EXTENSION_FUNCTION("webstorePrivate.installBundle",
- WEBSTOREPRIVATE_INSTALLBUNDLE)
-
- WebstorePrivateInstallBundleFunction();
-
- // BundleInstaller::Delegate:
- void OnBundleInstallApproved() override;
- void OnBundleInstallCanceled(bool user_initiated) override;
- void OnBundleInstallCompleted() override;
-
- protected:
- ~WebstorePrivateInstallBundleFunction() override;
-
- // ExtensionFunction:
- bool RunAsync() override;
-
- // Reads the extension |details| into |items|.
- bool ReadBundleInfo(
- const api::webstore_private::InstallBundle::Params& details,
- extensions::BundleInstaller::ItemList* items);
-
- private:
- scoped_refptr<extensions::BundleInstaller> bundle_;
-};
-
class WebstorePrivateBeginInstallWithManifest3Function
: public ChromeAsyncExtensionFunction,
public ExtensionInstallPrompt::Delegate,
diff --git a/chrome/common/extensions/api/webstore_private.json b/chrome/common/extensions/api/webstore_private.json
index 6ae32a9d..2ac2c7b 100644
--- a/chrome/common/extensions/api/webstore_private.json
+++ b/chrome/common/extensions/api/webstore_private.json
@@ -26,44 +26,6 @@
]
},
{
- "name": "installBundle",
- "description": "Initiates the install process for the given bundle of extensions.",
- "parameters": [
- {
- "name": "details",
- "description": "An array of extension details to be installed.",
- "type": "array",
- "items": {
- "type": "object",
- "properties": {
- "id": {
- "type": "string",
- "description": "The id of the extension to be installed.",
- "minLength": 32,
- "maxLength": 32
- },
- "manifest": {
- "type": "string",
- "description": "A string with the contents of the extension's manifest.json file. During the install process, the browser will check that the downloaded extension's manifest matches what was passed in here.",
- "minLength": 1
- },
- "localizedName": {
- "type": "string",
- "description": "A string to use instead of the raw value of the 'name' key from manifest.json."
- }
- }
- }
- },
- {
- "name": "callback",
- "type": "function",
- "description": "Called when the install process completes. Upon failures, chrome.runtime.lastError will be set to 'user_canceled' or 'unknown_error'.",
- "optional": true,
- "parameters": []
- }
- ]
- },
- {
"name": "beginInstallWithManifest3",
"description": "Initiates the install process for the given extension.",
"parameters": [