OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profiles/profile_window.h" | 5 #include "chrome/browser/profiles/profile_window.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
303 void LockProfile(Profile* profile) { | 303 void LockProfile(Profile* profile) { |
304 DCHECK(profile); | 304 DCHECK(profile); |
305 if (profile) { | 305 if (profile) { |
306 BrowserList::CloseAllBrowsersWithProfile( | 306 BrowserList::CloseAllBrowsersWithProfile( |
307 profile, base::Bind(&LockBrowserCloseSuccess)); | 307 profile, base::Bind(&LockBrowserCloseSuccess)); |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 bool IsLockAvailable(Profile* profile) { | 311 bool IsLockAvailable(Profile* profile) { |
312 DCHECK(profile); | 312 DCHECK(profile); |
313 if (!switches::IsNewProfileManagement()) | |
314 return false; | |
315 | |
313 const std::string& hosted_domain = profile->GetPrefs()-> | 316 const std::string& hosted_domain = profile->GetPrefs()-> |
314 GetString(prefs::kGoogleServicesHostedDomain); | 317 GetString(prefs::kGoogleServicesHostedDomain); |
315 return switches::IsNewProfileManagement() && | 318 if (hosted_domain != Profile::kNoHostedDomainFound && |
316 (hosted_domain == Profile::kNoHostedDomainFound || | 319 hosted_domain != "google.com") { |
Alexei Svitkine (slow)
2014/10/31 17:13:11
This should probably have a comment about why we'r
| |
317 hosted_domain == "google.com"); | 320 return false; |
321 } | |
322 | |
323 ProfileInfoCache* cache = | |
324 &g_browser_process->profile_manager()->GetProfileInfoCache(); | |
Alexei Svitkine (slow)
2014/10/31 17:13:11
Can you use "const ProfileInfoCache&" instead?
| |
325 for (size_t i = 0; i < cache->GetNumberOfProfiles(); ++i) { | |
326 if (cache->ProfileIsSupervisedAtIndex(i)) | |
327 return true; | |
328 } | |
329 return false; | |
318 } | 330 } |
319 | 331 |
320 void CreateGuestProfileForUserManager( | 332 void CreateGuestProfileForUserManager( |
321 const base::FilePath& profile_path_to_focus, | 333 const base::FilePath& profile_path_to_focus, |
322 profiles::UserManagerTutorialMode tutorial_mode, | 334 profiles::UserManagerTutorialMode tutorial_mode, |
323 profiles::UserManagerProfileSelected profile_open_action, | 335 profiles::UserManagerProfileSelected profile_open_action, |
324 const base::Callback<void(Profile*, const std::string&)>& callback) { | 336 const base::Callback<void(Profile*, const std::string&)>& callback) { |
325 // Create the guest profile, if necessary, and open the User Manager | 337 // Create the guest profile, if necessary, and open the User Manager |
326 // from the guest profile. | 338 // from the guest profile. |
327 g_browser_process->profile_manager()->CreateProfileAsync( | 339 g_browser_process->profile_manager()->CreateProfileAsync( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: | 432 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: |
421 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 433 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
422 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; | 434 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; |
423 return; | 435 return; |
424 default: | 436 default: |
425 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 437 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
426 } | 438 } |
427 } | 439 } |
428 | 440 |
429 } // namespace profiles | 441 } // namespace profiles |
OLD | NEW |