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

Unified Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 412043003: Make --install-chrome-app use extensions::WebstoreInstallWithPrompt. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep install_chrome_app Created 6 years, 5 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/ui/startup/startup_browser_creator.cc
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index cc9a84beee35e5910e4388176ba4a622c49fae66..d89bbe8e5684b73e57d8b6ec50e7a516ea77df53 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -28,6 +28,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/app_mode/app_mode_utils.h"
+#include "chrome/browser/apps/install_chrome_app.h"
#include "chrome/browser/auto_launch_trial.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -507,6 +508,14 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
return false;
}
+ std::vector<GURL> extra_urls_to_launch;
tapted 2014/07/25 03:49:12 URLs are already added in StartupBrowserCreator::L
jackhou1 2014/07/28 02:58:15 I open up the webstore page because WebstoreStartu
+ if (command_line.HasSwitch(switches::kInstallChromeApp)) {
+ extensions::StartupHelper helper;
+ helper.InstallChromeApp(command_line, last_used_profile);
+ extra_urls_to_launch.push_back(install_chrome_app::GetAppInstallUrl(
+ command_line.GetSwitchValueASCII(switches::kInstallChromeApp)));
+ }
+
if (command_line.HasSwitch(switches::kValidateCrx)) {
if (!process_startup) {
LOG(ERROR) << "chrome is already running; you must close all running "
@@ -609,6 +618,13 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
chrome::startup::IS_NOT_PROCESS_STARTUP;
chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ?
chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN;
+ CommandLine command_line_with_extra_urls(command_line);
+ for (std::vector<GURL>::const_iterator it = extra_urls_to_launch.begin();
+ it != extra_urls_to_launch.end();
+ ++it) {
+ if (it->is_valid())
+ command_line_with_extra_urls.AppendArg(it->spec());
+ }
// |last_opened_profiles| will be empty in the following circumstances:
// - This is the first launch. |last_used_profile| is the initial profile.
// - The user exited the browser by closing all windows for all
@@ -631,7 +647,8 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
return true;
}
}
- if (!browser_creator->LaunchBrowser(command_line, last_used_profile,
+ if (!browser_creator->LaunchBrowser(command_line_with_extra_urls,
+ last_used_profile,
cur_dir, is_process_startup,
is_first_run, return_code)) {
return false;
@@ -665,8 +682,8 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
continue;
if (!browser_creator->LaunchBrowser((*it == last_used_profile) ?
- command_line : command_line_without_urls, *it, cur_dir,
- is_process_startup, is_first_run, return_code))
+ command_line_with_extra_urls : command_line_without_urls, *it,
+ cur_dir, is_process_startup, is_first_run, return_code))
return false;
// We've launched at least one browser.
is_process_startup = chrome::startup::IS_NOT_PROCESS_STARTUP;

Powered by Google App Engine
This is Rietveld 408576698