 Chromium Code Reviews
 Chromium Code Reviews Issue 15947007:
  Move application restart and relaunch code out of ExtensionService.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 15947007:
  Move application restart and relaunch code out of ExtensionService.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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..68d28a28cc1baa06b1728b7c7d077c8af5949df4 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); | 
| 
sky
2013/05/30 15:33:32
nit: indent 2 more spaces.
 
benwells
2013/05/31 01:13:04
Done.
 | 
| + | 
| // 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. |