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

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

Issue 2762173003: Remove IsNewProfileManagement and EnableNewProfileManagementForTesting (Closed)
Patch Set: Fix compile (add back an include) Created 3 years, 9 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> // For max(). 9 #include <algorithm> // For max().
10 #include <limits> 10 #include <limits>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "chrome/common/chrome_paths.h" 64 #include "chrome/common/chrome_paths.h"
65 #include "chrome/common/chrome_result_codes.h" 65 #include "chrome/common/chrome_result_codes.h"
66 #include "chrome/common/chrome_switches.h" 66 #include "chrome/common/chrome_switches.h"
67 #include "chrome/common/features.h" 67 #include "chrome/common/features.h"
68 #include "chrome/common/pref_names.h" 68 #include "chrome/common/pref_names.h"
69 #include "chrome/common/url_constants.h" 69 #include "chrome/common/url_constants.h"
70 #include "components/google/core/browser/google_util.h" 70 #include "components/google/core/browser/google_util.h"
71 #include "components/prefs/pref_registry_simple.h" 71 #include "components/prefs/pref_registry_simple.h"
72 #include "components/prefs/pref_service.h" 72 #include "components/prefs/pref_service.h"
73 #include "components/search_engines/util.h" 73 #include "components/search_engines/util.h"
74 #include "components/signin/core/common/profile_management_switches.h"
75 #include "components/url_formatter/url_fixer.h" 74 #include "components/url_formatter/url_fixer.h"
76 #include "content/public/browser/browser_thread.h" 75 #include "content/public/browser/browser_thread.h"
77 #include "content/public/browser/child_process_security_policy.h" 76 #include "content/public/browser/child_process_security_policy.h"
78 #include "content/public/browser/navigation_controller.h" 77 #include "content/public/browser/navigation_controller.h"
79 #include "content/public/common/content_switches.h" 78 #include "content/public/common/content_switches.h"
80 #include "extensions/common/switches.h" 79 #include "extensions/common/switches.h"
81 #include "net/base/port_util.h" 80 #include "net/base/port_util.h"
82 #include "printing/features/features.h" 81 #include "printing/features/features.h"
83 82
84 #if defined(USE_ASH) 83 #if defined(USE_ASH)
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 Profile* profile = profile_manager->GetProfile(profile_path); 956 Profile* profile = profile_manager->GetProfile(profile_path);
958 957
959 // If there is no entry in profile attributes storage, the profile is deleted, 958 // If there is no entry in profile attributes storage, the profile is deleted,
960 // and we should show the user manager. Also, when using 959 // and we should show the user manager. Also, when using
961 // --new-profile-management, if the profile is locked we should show the user 960 // --new-profile-management, if the profile is locked we should show the user
962 // manager as well. When neither of these is true, we can safely start up with 961 // manager as well. When neither of these is true, we can safely start up with
963 // |profile|. 962 // |profile|.
964 auto* storage = &profile_manager->GetProfileAttributesStorage(); 963 auto* storage = &profile_manager->GetProfileAttributesStorage();
965 ProfileAttributesEntry* entry; 964 ProfileAttributesEntry* entry;
966 bool has_entry = storage->GetProfileAttributesWithPath(profile_path, &entry); 965 bool has_entry = storage->GetProfileAttributesWithPath(profile_path, &entry);
967 if (has_entry && (!switches::IsNewProfileManagement() || 966 if (has_entry && (!entry->IsSigninRequired() || !profile)) {
968 !entry->IsSigninRequired() || !profile)) {
969 return profile; 967 return profile;
970 } 968 }
971 969
972 // We want to show the user manager. To indicate this, return the guest 970 // We want to show the user manager. To indicate this, return the guest
973 // profile. However, we can only do this if the system profile (where the user 971 // profile. However, we can only do this if the system profile (where the user
974 // manager lives) also exists (or is creatable). 972 // manager lives) also exists (or is creatable).
975 return profile_manager->GetProfile(ProfileManager::GetSystemProfilePath()) ? 973 return profile_manager->GetProfile(ProfileManager::GetSystemProfilePath()) ?
976 profile_manager->GetProfile(ProfileManager::GetGuestProfilePath()) : 974 profile_manager->GetProfile(ProfileManager::GetGuestProfilePath()) :
977 nullptr; 975 nullptr;
978 } 976 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 if (!entry->IsSigninRequired()) { 1010 if (!entry->IsSigninRequired()) {
1013 Profile* profile = profile_manager->GetProfile(entry->GetPath()); 1011 Profile* profile = profile_manager->GetProfile(entry->GetPath());
1014 if (profile) 1012 if (profile)
1015 return profile; 1013 return profile;
1016 } 1014 }
1017 } 1015 }
1018 1016
1019 return nullptr; 1017 return nullptr;
1020 } 1018 }
1021 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) 1019 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698