OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "apps/app_load_service.h" | 10 #include "apps/app_load_service.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 // of an automation request), we are done here. | 615 // of an automation request), we are done here. |
616 if (silent_launch) | 616 if (silent_launch) |
617 return true; | 617 return true; |
618 | 618 |
619 // Check for --load-and-launch-app. | 619 // Check for --load-and-launch-app. |
620 if (command_line.HasSwitch(apps::kLoadAndLaunchApp) && | 620 if (command_line.HasSwitch(apps::kLoadAndLaunchApp) && |
621 !IncognitoModePrefs::ShouldLaunchIncognito( | 621 !IncognitoModePrefs::ShouldLaunchIncognito( |
622 command_line, last_used_profile->GetPrefs())) { | 622 command_line, last_used_profile->GetPrefs())) { |
623 CommandLine::StringType path = command_line.GetSwitchValueNative( | 623 CommandLine::StringType path = command_line.GetSwitchValueNative( |
624 apps::kLoadAndLaunchApp); | 624 apps::kLoadAndLaunchApp); |
625 std::string extension_id; | 625 |
626 if (!extensions::UnpackedInstaller::Create( | 626 if (!apps::AppLoadService::Get(last_used_profile)->LoadAndLaunch( |
627 last_used_profile->GetExtensionService())-> | 627 base::FilePath(path), command_line, cur_dir)) { |
628 LoadFromCommandLine(base::FilePath(path), &extension_id)) { | |
629 return false; | 628 return false; |
630 } | 629 } |
631 | 630 |
632 // Schedule the app to be launched once loaded. | |
633 apps::AppLoadService::Get(last_used_profile)->ScheduleLaunchOnLoad( | |
634 extension_id); | |
635 | |
636 // Return early here since we don't want to open a browser window. | 631 // Return early here since we don't want to open a browser window. |
637 // The exception is when there are no browser windows, since we don't want | 632 // The exception is when there are no browser windows, since we don't want |
638 // chrome to shut down. | 633 // chrome to shut down. |
639 // TODO(jackhou): Do this properly once keep-alive is handled by the | 634 // TODO(jackhou): Do this properly once keep-alive is handled by the |
640 // background page of apps. Tracked at http://crbug.com/175381 | 635 // background page of apps. Tracked at http://crbug.com/175381 |
641 if (chrome::GetTotalBrowserCountForProfile(last_used_profile) != 0) | 636 if (chrome::GetTotalBrowserCountForProfile(last_used_profile) != 0) |
642 return true; | 637 return true; |
643 } | 638 } |
644 | 639 |
645 chrome::startup::IsProcessStartup is_process_startup = process_startup ? | 640 chrome::startup::IsProcessStartup is_process_startup = process_startup ? |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
750 | 745 |
751 // static | 746 // static |
752 bool StartupBrowserCreator::ActivatedProfile() { | 747 bool StartupBrowserCreator::ActivatedProfile() { |
753 return profile_launch_observer.Get().activated_profile(); | 748 return profile_launch_observer.Get().activated_profile(); |
754 } | 749 } |
755 | 750 |
756 bool HasPendingUncleanExit(Profile* profile) { | 751 bool HasPendingUncleanExit(Profile* profile) { |
757 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && | 752 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && |
758 !profile_launch_observer.Get().HasBeenLaunched(profile); | 753 !profile_launch_observer.Get().HasBeenLaunched(profile); |
759 } | 754 } |
OLD | NEW |