| 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/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/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 DCHECK(profile_path_being_created_.empty()); | 75 DCHECK(profile_path_being_created_.empty()); |
| 76 profile_creation_start_time_ = base::TimeTicks::Now(); | 76 profile_creation_start_time_ = base::TimeTicks::Now(); |
| 77 | 77 |
| 78 base::string16 name; | 78 base::string16 name; |
| 79 base::string16 icon; | 79 base::string16 icon; |
| 80 std::string supervised_user_id; | 80 std::string supervised_user_id; |
| 81 bool create_shortcut = false; | 81 bool create_shortcut = false; |
| 82 bool supervised_user = false; | 82 bool supervised_user = false; |
| 83 if (args->GetString(0, &name) && args->GetString(1, &icon)) { | 83 if (args->GetString(0, &name) && args->GetString(1, &icon)) { |
| 84 base::TrimWhitespace(name, base::TRIM_ALL, &name); | 84 base::TrimWhitespace(name, base::TRIM_ALL, &name); |
| 85 CHECK(!name.empty()); |
| 85 if (args->GetBoolean(2, &create_shortcut)) { | 86 if (args->GetBoolean(2, &create_shortcut)) { |
| 86 bool success = args->GetBoolean(3, &supervised_user); | 87 bool success = args->GetBoolean(3, &supervised_user); |
| 87 DCHECK(success); | 88 DCHECK(success); |
| 88 success = args->GetString(4, &supervised_user_id); | 89 success = args->GetString(4, &supervised_user_id); |
| 89 DCHECK(success); | 90 DCHECK(success); |
| 90 } | 91 } |
| 91 } | 92 } |
| 92 | 93 |
| 93 if (supervised_user) { | 94 if (supervised_user) { |
| 94 if (!IsValidExistingSupervisedUserId(supervised_user_id)) | 95 if (!IsValidExistingSupervisedUserId(supervised_user_id)) |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 g_browser_process->profile_manager()->GetProfileInfoCache(); | 428 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 428 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 429 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
| 429 if (existing_supervised_user_id == | 430 if (existing_supervised_user_id == |
| 430 cache.GetSupervisedUserIdOfProfileAtIndex(i)) | 431 cache.GetSupervisedUserIdOfProfileAtIndex(i)) |
| 431 return false; | 432 return false; |
| 432 } | 433 } |
| 433 return true; | 434 return true; |
| 434 } | 435 } |
| 435 | 436 |
| 436 } // namespace options | 437 } // namespace options |
| OLD | NEW |