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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
740 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? | 740 chrome::startup::IsFirstRun is_first_run = first_run::IsChromeFirstRun() ? |
741 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 741 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
742 // |last_opened_profiles| will be empty in the following circumstances: | 742 // |last_opened_profiles| will be empty in the following circumstances: |
743 // - This is the first launch. |last_used_profile| is the initial profile. | 743 // - This is the first launch. |last_used_profile| is the initial profile. |
744 // - The user exited the browser by closing all windows for all | 744 // - The user exited the browser by closing all windows for all |
745 // profiles. |last_used_profile| is the profile which owned the last open | 745 // profiles. |last_used_profile| is the profile which owned the last open |
746 // window. | 746 // window. |
747 // - Only incognito windows were open when the browser exited. | 747 // - Only incognito windows were open when the browser exited. |
748 // |last_used_profile| is the last used incognito profile. Restoring it will | 748 // |last_used_profile| is the last used incognito profile. Restoring it will |
749 // create a browser window for the corresponding original profile. | 749 // create a browser window for the corresponding original profile. |
750 // - All of the last opened profiles fail to initialize, i.e. having all | |
751 // nullptr returns in Profile::CreateProfile. | |
Peter Kasting
2016/05/31 19:12:30
Nit: I'd probably just leave off the second clause
WC Leung
2016/06/01 18:56:55
I see. Now the second clause is removed.
| |
750 if (last_opened_profiles.empty()) { | 752 if (last_opened_profiles.empty()) { |
751 if (ShowUserManagerOnStartupIfNeeded(last_used_profile, command_line)) | 753 if (ShowUserManagerOnStartupIfNeeded(last_used_profile, command_line)) |
752 return true; | 754 return true; |
753 | 755 |
754 Profile* profile_to_open = last_used_profile->IsGuestSession() ? | 756 Profile* profile_to_open = last_used_profile->IsGuestSession() ? |
755 last_used_profile->GetOffTheRecordProfile() : last_used_profile; | 757 last_used_profile->GetOffTheRecordProfile() : last_used_profile; |
756 | 758 |
757 if (!LaunchBrowser(command_line, profile_to_open, cur_dir, | 759 if (!LaunchBrowser(command_line, profile_to_open, cur_dir, |
758 is_process_startup, is_first_run)) { | 760 is_process_startup, is_first_run)) { |
759 return false; | 761 return false; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
895 #if defined(ENABLE_APP_LIST) | 897 #if defined(ENABLE_APP_LIST) |
896 // If we are showing the app list then chrome isn't shown so load the app | 898 // If we are showing the app list then chrome isn't shown so load the app |
897 // list's profile rather than chrome's. | 899 // list's profile rather than chrome's. |
898 if (command_line.HasSwitch(switches::kShowAppList)) | 900 if (command_line.HasSwitch(switches::kShowAppList)) |
899 return AppListService::Get()->GetProfilePath(user_data_dir); | 901 return AppListService::Get()->GetProfilePath(user_data_dir); |
900 #endif | 902 #endif |
901 | 903 |
902 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 904 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
903 user_data_dir); | 905 user_data_dir); |
904 } | 906 } |
OLD | NEW |