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

Unified Diff: chrome/browser/extensions/startup_helper.cc

Issue 617833003: Remove --install-from-webstore and --limited-install-from-webstore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/startup_helper.cc
diff --git a/chrome/browser/extensions/startup_helper.cc b/chrome/browser/extensions/startup_helper.cc
index 25cd85e66a1125a226baa7709f24f162b2d9a057..36f427cc253a110d4850d65e9545c8066757d0a2 100644
--- a/chrome/browser/extensions/startup_helper.cc
+++ b/chrome/browser/extensions/startup_helper.cc
@@ -34,6 +34,8 @@
using content::BrowserThread;
+namespace extensions {
+
namespace {
void PrintPackExtensionMessage(const std::string& message) {
@@ -41,32 +43,30 @@ void PrintPackExtensionMessage(const std::string& message) {
}
// On Windows, the jumplist action for installing an ephemeral app has to use
-// the --install-from-webstore command line arg to initiate an install.
-scoped_refptr<extensions::WebstoreStandaloneInstaller>
-CreateEphemeralAppInstaller(
+// the --install-ephemeral-app-from-webstore command line arg to initiate an
+// install.
+scoped_refptr<WebstoreStandaloneInstaller> CreateEphemeralAppInstaller(
Profile* profile,
const std::string& app_id,
- extensions::WebstoreStandaloneInstaller::Callback callback) {
- scoped_refptr<extensions::WebstoreStandaloneInstaller> installer;
+ WebstoreStandaloneInstaller::Callback callback) {
+ scoped_refptr<WebstoreStandaloneInstaller> installer;
#if defined(OS_WIN)
- using extensions::ExtensionRegistry;
ExtensionRegistry* registry = ExtensionRegistry::Get(profile);
DCHECK(registry);
if (!registry->GetExtensionById(app_id, ExtensionRegistry::EVERYTHING) ||
- !extensions::util::IsEphemeralApp(app_id, profile)) {
+ !util::IsEphemeralApp(app_id, profile)) {
return installer;
}
- extensions::AppWindowRegistry* app_window_registry =
- extensions::AppWindowRegistry::Get(profile);
+ AppWindowRegistry* app_window_registry = AppWindowRegistry::Get(profile);
DCHECK(app_window_registry);
- extensions::AppWindow* app_window =
+ AppWindow* app_window =
app_window_registry->GetCurrentAppWindowForApp(app_id);
if (!app_window)
return installer;
- installer = new extensions::WebstoreInstallWithPrompt(
+ installer = new WebstoreInstallWithPrompt(
app_id, profile, app_window->GetNativeWindow(), callback);
#endif
@@ -75,8 +75,6 @@ CreateEphemeralAppInstaller(
} // namespace
-namespace extensions {
-
StartupHelper::StartupHelper() : pack_job_succeeded_(false) {
ExtensionsClient::Set(ChromeExtensionsClient::GetInstance());
}
@@ -288,11 +286,12 @@ void AppInstallHelper::BeginInstall(
base::Unretained(this));
installer_ = CreateEphemeralAppInstaller(profile, id, callback);
- if (!installer_.get()) {
- installer_ =
- new WebstoreStartupInstaller(id, profile, show_prompt, callback);
+ if (installer_.get()) {
+ installer_->BeginInstall();
+ } else {
+ error_ = "Not a supported ephemeral app installation.";
+ done_callback_.Run();
}
- installer_->BeginInstall();
}
void AppInstallHelper::OnAppInstallComplete(bool success,
@@ -303,20 +302,15 @@ void AppInstallHelper::OnAppInstallComplete(bool success,
done_callback_.Run();
}
-void DeleteHelperAndRunCallback(AppInstallHelper* helper,
- base::Callback<void()> callback) {
- delete helper;
- callback.Run();
-}
-
} // namespace
-bool StartupHelper::InstallFromWebstore(const CommandLine& cmd_line,
+bool StartupHelper::InstallEphemeralApp(const CommandLine& cmd_line,
Profile* profile) {
- std::string id = cmd_line.GetSwitchValueASCII(switches::kInstallFromWebstore);
+ std::string id =
+ cmd_line.GetSwitchValueASCII(switches::kInstallEphemeralAppFromWebstore);
if (!crx_file::id_util::IdIsValid(id)) {
- LOG(ERROR) << "Invalid id for " << switches::kInstallFromWebstore
- << " : '" << id << "'";
+ LOG(ERROR) << "Invalid id for "
+ << switches::kInstallEphemeralAppFromWebstore << " : '" << id << "'";
return false;
}
@@ -330,36 +324,6 @@ bool StartupHelper::InstallFromWebstore(const CommandLine& cmd_line,
return helper.success();
}
-void StartupHelper::LimitedInstallFromWebstore(
- const CommandLine& cmd_line,
- Profile* profile,
- base::Callback<void()> done_callback) {
- std::string id = WebStoreIdFromLimitedInstallCmdLine(cmd_line);
- if (!crx_file::id_util::IdIsValid(id)) {
- LOG(ERROR) << "Invalid index for " << switches::kLimitedInstallFromWebstore;
- done_callback.Run();
- return;
- }
-
- AppInstallHelper* helper = new AppInstallHelper();
- helper->BeginInstall(profile, id, false /*show_prompt*/,
- base::Bind(&DeleteHelperAndRunCallback,
- helper, done_callback));
-}
-
-std::string StartupHelper::WebStoreIdFromLimitedInstallCmdLine(
- const CommandLine& cmd_line) {
- std::string index = cmd_line.GetSwitchValueASCII(
- switches::kLimitedInstallFromWebstore);
- std::string id;
- if (index == "1") {
- id = "nckgahadagoaajjgafhacjanaoiihapd";
- } else if (index == "2") {
- id = "ecglahbcnmdpdciemllbhojghbkagdje";
- }
- return id;
-}
-
StartupHelper::~StartupHelper() {
if (pack_job_.get())
pack_job_->ClearClient();
« no previous file with comments | « chrome/browser/extensions/startup_helper.h ('k') | chrome/browser/extensions/webstore_startup_installer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698