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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 void LockProfile(Profile* profile) { | 304 void LockProfile(Profile* profile) { |
305 DCHECK(profile); | 305 DCHECK(profile); |
306 if (profile) { | 306 if (profile) { |
307 BrowserList::CloseAllBrowsersWithProfile( | 307 BrowserList::CloseAllBrowsersWithProfile( |
308 profile, base::Bind(&LockBrowserCloseSuccess)); | 308 profile, base::Bind(&LockBrowserCloseSuccess)); |
309 } | 309 } |
310 } | 310 } |
311 | 311 |
312 bool IsLockAvailable(Profile* profile) { | 312 bool IsLockAvailable(Profile* profile) { |
313 DCHECK(profile); | 313 DCHECK(profile); |
314 if (!switches::IsNewProfileManagement()) | |
315 return false; | |
316 | |
314 const std::string& hosted_domain = profile->GetPrefs()-> | 317 const std::string& hosted_domain = profile->GetPrefs()-> |
315 GetString(prefs::kGoogleServicesHostedDomain); | 318 GetString(prefs::kGoogleServicesHostedDomain); |
316 return switches::IsNewProfileManagement() && | 319 if (hosted_domain != Profile::kNoHostedDomainFound && |
317 (hosted_domain == Profile::kNoHostedDomainFound || | 320 hosted_domain != "google.com") { |
318 hosted_domain == "google.com"); | 321 return false; |
322 } | |
323 | |
324 size_t num_supervised_profiles = 0; | |
325 ProfileInfoCache* cache = | |
326 &g_browser_process->profile_manager()->GetProfileInfoCache(); | |
327 | |
328 for (size_t i = 0; i < cache->GetNumberOfProfiles(); ++i) { | |
329 if (cache->ProfileIsSupervisedAtIndex(i)) | |
330 num_supervised_profiles++; | |
noms (inactive)
2014/10/14 14:22:01
nit: you can just return true here, and return fal
Mike Lerman
2014/10/29 15:28:48
Done.
| |
331 } | |
332 return num_supervised_profiles > 0; | |
319 } | 333 } |
320 | 334 |
321 void CreateGuestProfileForUserManager( | 335 void CreateGuestProfileForUserManager( |
322 const base::FilePath& profile_path_to_focus, | 336 const base::FilePath& profile_path_to_focus, |
323 profiles::UserManagerTutorialMode tutorial_mode, | 337 profiles::UserManagerTutorialMode tutorial_mode, |
324 profiles::UserManagerProfileSelected profile_open_action, | 338 profiles::UserManagerProfileSelected profile_open_action, |
325 const base::Callback<void(Profile*, const std::string&)>& callback) { | 339 const base::Callback<void(Profile*, const std::string&)>& callback) { |
326 // Create the guest profile, if necessary, and open the User Manager | 340 // Create the guest profile, if necessary, and open the User Manager |
327 // from the guest profile. | 341 // from the guest profile. |
328 g_browser_process->profile_manager()->CreateProfileAsync( | 342 g_browser_process->profile_manager()->CreateProfileAsync( |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: | 435 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: |
422 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 436 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
423 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; | 437 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; |
424 return; | 438 return; |
425 default: | 439 default: |
426 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; | 440 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; |
427 } | 441 } |
428 } | 442 } |
429 | 443 |
430 } // namespace profiles | 444 } // namespace profiles |
OLD | NEW |