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

Side by Side Diff: chrome/browser/ui/webui/options/create_profile_handler.cc

Issue 143903021: Add disable flag around supervised user import code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nit. Created 6 years, 10 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 | Annotate | Revision Log
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/ui/webui/options/create_profile_handler.h" 5 #include "chrome/browser/ui/webui/options/create_profile_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 NOTREACHED(); 406 NOTREACHED();
407 return std::string(); 407 return std::string();
408 } 408 }
409 409
410 bool CreateProfileHandler::IsValidExistingManagedUserId( 410 bool CreateProfileHandler::IsValidExistingManagedUserId(
411 const std::string& existing_managed_user_id) const { 411 const std::string& existing_managed_user_id) const {
412 if (existing_managed_user_id.empty()) 412 if (existing_managed_user_id.empty())
413 return true; 413 return true;
414 414
415 if (!CommandLine::ForCurrentProcess()->HasSwitch( 415 if (CommandLine::ForCurrentProcess()->HasSwitch(
416 switches::kAllowCreateExistingManagedUsers)) { 416 switches::kDisableCreateExistingManagedUsers)) {
417 return false; 417 return false;
418 } 418 }
419 419
420 Profile* profile = Profile::FromWebUI(web_ui()); 420 Profile* profile = Profile::FromWebUI(web_ui());
421 const base::DictionaryValue* dict = 421 const base::DictionaryValue* dict =
422 ManagedUserSyncServiceFactory::GetForProfile(profile)->GetManagedUsers(); 422 ManagedUserSyncServiceFactory::GetForProfile(profile)->GetManagedUsers();
423 if (!dict->HasKey(existing_managed_user_id)) 423 if (!dict->HasKey(existing_managed_user_id))
424 return false; 424 return false;
425 425
426 // Check if this managed user already exists on this machine. 426 // Check if this managed user already exists on this machine.
427 const ProfileInfoCache& cache = 427 const ProfileInfoCache& cache =
428 g_browser_process->profile_manager()->GetProfileInfoCache(); 428 g_browser_process->profile_manager()->GetProfileInfoCache();
429 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { 429 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) {
430 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) 430 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i))
431 return false; 431 return false;
432 } 432 }
433 return true; 433 return true;
434 } 434 }
435 435
436 } // namespace options 436 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/options.js ('k') | chrome/browser/ui/webui/options/manage_profile_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698