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

Side by Side Diff: chrome/browser/profiles/profile_window.cc

Issue 633233002: Lock only permitted where a supervised user is or was. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alexei's comments Created 6 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 void LockProfile(Profile* profile) { 311 void LockProfile(Profile* profile) {
312 DCHECK(profile); 312 DCHECK(profile);
313 if (profile) { 313 if (profile) {
314 BrowserList::CloseAllBrowsersWithProfile( 314 BrowserList::CloseAllBrowsersWithProfile(
315 profile, base::Bind(&LockBrowserCloseSuccess)); 315 profile, base::Bind(&LockBrowserCloseSuccess));
316 } 316 }
317 } 317 }
318 318
319 bool IsLockAvailable(Profile* profile) { 319 bool IsLockAvailable(Profile* profile) {
320 DCHECK(profile); 320 DCHECK(profile);
321 if (!switches::IsNewProfileManagement())
322 return false;
323
321 const std::string& hosted_domain = profile->GetPrefs()-> 324 const std::string& hosted_domain = profile->GetPrefs()->
322 GetString(prefs::kGoogleServicesHostedDomain); 325 GetString(prefs::kGoogleServicesHostedDomain);
323 return switches::IsNewProfileManagement() && 326 // TODO(mlerman): Prohibit only users who authenticate using SAML. Until then,
324 (hosted_domain == Profile::kNoHostedDomainFound || 327 // prohibited users who use hosted domains (aside from google.com).
325 hosted_domain == "google.com"); 328 if (hosted_domain != Profile::kNoHostedDomainFound &&
329 hosted_domain != "google.com") {
330 return false;
331 }
332
333 const ProfileInfoCache& cache =
334 g_browser_process->profile_manager()->GetProfileInfoCache();
335 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
336 if (cache.ProfileIsSupervisedAtIndex(i))
337 return true;
338 }
339 return false;
326 } 340 }
327 341
328 void CreateGuestProfileForUserManager( 342 void CreateGuestProfileForUserManager(
329 const base::FilePath& profile_path_to_focus, 343 const base::FilePath& profile_path_to_focus,
330 profiles::UserManagerTutorialMode tutorial_mode, 344 profiles::UserManagerTutorialMode tutorial_mode,
331 profiles::UserManagerProfileSelected profile_open_action, 345 profiles::UserManagerProfileSelected profile_open_action,
332 const base::Callback<void(Profile*, const std::string&)>& callback) { 346 const base::Callback<void(Profile*, const std::string&)>& callback) {
333 // Create the guest profile, if necessary, and open the User Manager 347 // Create the guest profile, if necessary, and open the User Manager
334 // from the guest profile. 348 // from the guest profile.
335 g_browser_process->profile_manager()->CreateProfileAsync( 349 g_browser_process->profile_manager()->CreateProfileAsync(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR: 442 case BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR:
429 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER; 443 *bubble_view_mode = BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
430 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR; 444 *tutorial_mode = TUTORIAL_MODE_SHOW_ERROR;
431 return; 445 return;
432 default: 446 default:
433 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER; 447 *bubble_view_mode = profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER;
434 } 448 }
435 } 449 }
436 450
437 } // namespace profiles 451 } // namespace profiles
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698