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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> // For max(). | 9 #include <algorithm> // For max(). |
10 #include <memory> | 10 #include <memory> |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? | 723 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? |
724 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 724 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
725 // |last_opened_profiles| will be empty in the following circumstances: | 725 // |last_opened_profiles| will be empty in the following circumstances: |
726 // - This is the first launch. |last_used_profile| is the initial profile. | 726 // - This is the first launch. |last_used_profile| is the initial profile. |
727 // - The user exited the browser by closing all windows for all | 727 // - The user exited the browser by closing all windows for all |
728 // profiles. |last_used_profile| is the profile which owned the last open | 728 // profiles. |last_used_profile| is the profile which owned the last open |
729 // window. | 729 // window. |
730 // - Only incognito windows were open when the browser exited. | 730 // - Only incognito windows were open when the browser exited. |
731 // |last_used_profile| is the last used incognito profile. Restoring it will | 731 // |last_used_profile| is the last used incognito profile. Restoring it will |
732 // create a browser window for the corresponding original profile. | 732 // create a browser window for the corresponding original profile. |
| 733 // - All of the last opened profiles fail to initialize. |
733 if (last_opened_profiles.empty()) { | 734 if (last_opened_profiles.empty()) { |
734 if (ShowUserManagerOnStartupIfNeeded(last_used_profile, command_line)) | 735 if (ShowUserManagerOnStartupIfNeeded(last_used_profile, command_line)) |
735 return true; | 736 return true; |
736 | 737 |
737 Profile* profile_to_open = last_used_profile->IsGuestSession() ? | 738 Profile* profile_to_open = last_used_profile->IsGuestSession() ? |
738 last_used_profile->GetOffTheRecordProfile() : last_used_profile; | 739 last_used_profile->GetOffTheRecordProfile() : last_used_profile; |
739 | 740 |
740 if (!LaunchBrowser(command_line, profile_to_open, cur_dir, | 741 if (!LaunchBrowser(command_line, profile_to_open, cur_dir, |
741 is_process_startup, is_first_run)) { | 742 is_process_startup, is_first_run)) { |
742 return false; | 743 return false; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 #if defined(ENABLE_APP_LIST) | 879 #if defined(ENABLE_APP_LIST) |
879 // If we are showing the app list then chrome isn't shown so load the app | 880 // If we are showing the app list then chrome isn't shown so load the app |
880 // list's profile rather than chrome's. | 881 // list's profile rather than chrome's. |
881 if (command_line.HasSwitch(switches::kShowAppList)) | 882 if (command_line.HasSwitch(switches::kShowAppList)) |
882 return AppListService::Get()->GetProfilePath(user_data_dir); | 883 return AppListService::Get()->GetProfilePath(user_data_dir); |
883 #endif | 884 #endif |
884 | 885 |
885 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 886 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
886 user_data_dir); | 887 user_data_dir); |
887 } | 888 } |
OLD | NEW |