Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 1129293002: Fix the System Profile with extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: and a few fewer unnecessary checks Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 VLOG(2) << "ProcessCmdLineImpl: PLACE 6.A"; 675 VLOG(2) << "ProcessCmdLineImpl: PLACE 6.A";
676 // If the last used profile is locked or was a guest, show the user manager. 676 // If the last used profile is locked or was a guest, show the user manager.
677 if (switches::IsNewAvatarMenu()) { 677 if (switches::IsNewAvatarMenu()) {
678 ProfileInfoCache& profile_info = 678 ProfileInfoCache& profile_info =
679 g_browser_process->profile_manager()->GetProfileInfoCache(); 679 g_browser_process->profile_manager()->GetProfileInfoCache();
680 size_t profile_index = profile_info.GetIndexOfProfileWithPath( 680 size_t profile_index = profile_info.GetIndexOfProfileWithPath(
681 last_used_profile->GetPath()); 681 last_used_profile->GetPath());
682 bool signin_required = profile_index != std::string::npos && 682 bool signin_required = profile_index != std::string::npos &&
683 profile_info.ProfileIsSigninRequiredAtIndex(profile_index); 683 profile_info.ProfileIsSigninRequiredAtIndex(profile_index);
684 684
685 // Guest or locked profiles cannot be re-opened on startup. The only 685 // Guest, system or locked profiles cannot be re-opened on startup. The
686 // exception is if there's already a Guest window open in a separate 686 // only exception is if there's already a Guest window open in a separate
687 // process (for example, launching a new browser after clicking on a 687 // process (for example, launching a new browser after clicking on a
688 // downloaded file in Guest mode). 688 // downloaded file in Guest mode).
689 bool has_guest_browsers = last_used_profile->IsGuestSession() && 689 bool guest_or_system = last_used_profile->IsGuestSession() ||
690 last_used_profile->IsSystemProfile();
691 bool has_guest_browsers = guest_or_system &&
690 chrome::GetTotalBrowserCountForProfile( 692 chrome::GetTotalBrowserCountForProfile(
691 last_used_profile->GetOffTheRecordProfile()) > 0; 693 last_used_profile->GetOffTheRecordProfile()) > 0;
msw 2015/05/21 04:34:43 Is GetOffTheRecordProfile safe to call for the sys
Mike Lerman 2015/05/21 15:27:31 Don't see why not? the function just iterates over
msw 2015/05/21 17:48:12 Acknowledged.
692 if (signin_required || 694 if (signin_required || (guest_or_system && !has_guest_browsers)) {
693 (last_used_profile->IsGuestSession() && !has_guest_browsers)) {
694 profiles::UserManagerProfileSelected action = 695 profiles::UserManagerProfileSelected action =
695 command_line.HasSwitch(switches::kShowAppList) ? 696 command_line.HasSwitch(switches::kShowAppList) ?
696 profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER : 697 profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER :
697 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION; 698 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION;
698 UserManager::Show( 699 UserManager::Show(
699 base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, action); 700 base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, action);
700 return true; 701 return true;
701 } 702 }
702 } 703 }
703 704
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 // If we are showing the app list then chrome isn't shown so load the app 850 // If we are showing the app list then chrome isn't shown so load the app
850 // list's profile rather than chrome's. 851 // list's profile rather than chrome's.
851 if (command_line.HasSwitch(switches::kShowAppList)) { 852 if (command_line.HasSwitch(switches::kShowAppList)) {
852 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> 853 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)->
853 GetProfilePath(user_data_dir); 854 GetProfilePath(user_data_dir);
854 } 855 }
855 856
856 return g_browser_process->profile_manager()->GetLastUsedProfileDir( 857 return g_browser_process->profile_manager()->GetLastUsedProfileDir(
857 user_data_dir); 858 user_data_dir);
858 } 859 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698