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

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

Issue 15947007: Move application restart and relaunch code out of ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pafooey Created 7 years, 7 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 84ccaf305fe568044cdce0abe072adaa36a5f37c..3cb7888c7d52bc631674bf2c335cda3834015d71 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -7,6 +7,8 @@
#include <algorithm> // For max().
#include <set>
+#include "apps/app_load_service.h"
+#include "apps/switches.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
@@ -615,14 +617,22 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
return true;
// Check for --load-and-launch-app.
- if (command_line.HasSwitch(switches::kLoadAndLaunchApp) &&
+ if (command_line.HasSwitch(apps::kLoadAndLaunchApp) &&
!IncognitoModePrefs::ShouldLaunchIncognito(
command_line, last_used_profile->GetPrefs())) {
CommandLine::StringType path = command_line.GetSwitchValueNative(
- switches::kLoadAndLaunchApp);
- extensions::UnpackedInstaller::Create(
- last_used_profile->GetExtensionService())->
- LoadFromCommandLine(base::FilePath(path), true);
+ apps::kLoadAndLaunchApp);
+ std::string extension_id;
+ if (!extensions::UnpackedInstaller::Create(
+ last_used_profile->GetExtensionService())->
+ LoadFromCommandLine(base::FilePath(path), &extension_id)) {
+ return false;
+ }
+
+ // Schedule the app to be launched once loaded.
+ apps::AppLoadService::Get(last_used_profile)->ScheduleLaunchOnLoad(
+ extension_id);
+
// Return early here since we don't want to open a browser window.
// The exception is when there are no browser windows, since we don't want
// chrome to shut down.
« no previous file with comments | « chrome/browser/ui/extensions/application_launch.cc ('k') | chrome/browser/ui/webui/extensions/extension_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698