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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 if (chrome::GetTotalBrowserCountForProfile(last_used_profile) != 0) | 642 if (chrome::GetTotalBrowserCountForProfile(last_used_profile) != 0) |
643 return true; | 643 return true; |
644 } | 644 } |
645 | 645 |
646 #if defined(OS_WIN) | 646 #if defined(OS_WIN) |
647 // Log whether this process was a result of an action in the Windows Jumplist. | 647 // Log whether this process was a result of an action in the Windows Jumplist. |
648 if (command_line.HasSwitch(switches::kWinJumplistAction)) { | 648 if (command_line.HasSwitch(switches::kWinJumplistAction)) { |
649 jumplist::LogJumplistActionFromSwitchValue( | 649 jumplist::LogJumplistActionFromSwitchValue( |
650 command_line.GetSwitchValueASCII(switches::kWinJumplistAction)); | 650 command_line.GetSwitchValueASCII(switches::kWinJumplistAction)); |
651 } | 651 } |
652 | |
653 // If the profile is loaded and the --activate-existing-profile-browser flag | |
654 // is used, activate one of the profile's browser windows, if one exists. | |
655 // Continuing to process the command line is not needed, since this will | |
656 // end up opening a new browser window. | |
657 if (command_line.HasSwitch(switches::kActivateExistingProfileBrowser)) { | |
658 Browser* browser = chrome::FindTabbedBrowser( | |
659 last_used_profile, false, chrome::HOST_DESKTOP_TYPE_NATIVE); | |
660 if (browser) { | |
661 browser->window()->Activate(); | |
662 return true; | |
663 } | |
664 } | |
665 #endif | 652 #endif |
666 | 653 |
667 VLOG(2) << "ProcessCmdLineImpl: PLACE 5"; | 654 VLOG(2) << "ProcessCmdLineImpl: PLACE 5"; |
668 chrome::startup::IsProcessStartup is_process_startup = process_startup ? | 655 chrome::startup::IsProcessStartup is_process_startup = process_startup ? |
669 chrome::startup::IS_PROCESS_STARTUP : | 656 chrome::startup::IS_PROCESS_STARTUP : |
670 chrome::startup::IS_NOT_PROCESS_STARTUP; | 657 chrome::startup::IS_NOT_PROCESS_STARTUP; |
671 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? | 658 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? |
672 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 659 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
673 // |last_opened_profiles| will be empty in the following circumstances: | 660 // |last_opened_profiles| will be empty in the following circumstances: |
674 // - This is the first launch. |last_used_profile| is the initial profile. | 661 // - This is the first launch. |last_used_profile| is the initial profile. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 // If we are showing the app list then chrome isn't shown so load the app | 843 // If we are showing the app list then chrome isn't shown so load the app |
857 // list's profile rather than chrome's. | 844 // list's profile rather than chrome's. |
858 if (command_line.HasSwitch(switches::kShowAppList)) { | 845 if (command_line.HasSwitch(switches::kShowAppList)) { |
859 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | 846 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
860 GetProfilePath(user_data_dir); | 847 GetProfilePath(user_data_dir); |
861 } | 848 } |
862 | 849 |
863 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 850 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
864 user_data_dir); | 851 user_data_dir); |
865 } | 852 } |
OLD | NEW |