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" |
11 #include "base/strings/string_util.h" | |
11 #include "base/value_conversions.h" | 12 #include "base/value_conversions.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/profiles/profile_metrics.h" | 16 #include "chrome/browser/profiles/profile_metrics.h" |
16 #include "chrome/browser/profiles/profiles_state.h" | 17 #include "chrome/browser/profiles/profiles_state.h" |
17 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" | 18 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" |
18 #include "chrome/browser/supervised_user/supervised_user_service.h" | 19 #include "chrome/browser/supervised_user/supervised_user_service.h" |
19 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 20 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
20 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" | 21 #include "chrome/browser/supervised_user/supervised_user_sync_service.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 74 |
74 DCHECK(profile_path_being_created_.empty()); | 75 DCHECK(profile_path_being_created_.empty()); |
75 profile_creation_start_time_ = base::TimeTicks::Now(); | 76 profile_creation_start_time_ = base::TimeTicks::Now(); |
76 | 77 |
77 base::string16 name; | 78 base::string16 name; |
78 base::string16 icon; | 79 base::string16 icon; |
79 std::string supervised_user_id; | 80 std::string supervised_user_id; |
80 bool create_shortcut = false; | 81 bool create_shortcut = false; |
81 bool supervised_user = false; | 82 bool supervised_user = false; |
82 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); | |
Dan Beam
2014/09/11 17:54:08
CHECK(!name.empty());
noms (inactive)
2014/09/15 21:12:26
Done in https://codereview.chromium.org/562233002.
| |
83 if (args->GetBoolean(2, &create_shortcut)) { | 85 if (args->GetBoolean(2, &create_shortcut)) { |
84 bool success = args->GetBoolean(3, &supervised_user); | 86 bool success = args->GetBoolean(3, &supervised_user); |
85 DCHECK(success); | 87 DCHECK(success); |
86 success = args->GetString(4, &supervised_user_id); | 88 success = args->GetString(4, &supervised_user_id); |
87 DCHECK(success); | 89 DCHECK(success); |
88 } | 90 } |
89 } | 91 } |
90 | 92 |
91 if (supervised_user) { | 93 if (supervised_user) { |
92 if (!IsValidExistingSupervisedUserId(supervised_user_id)) | 94 if (!IsValidExistingSupervisedUserId(supervised_user_id)) |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 g_browser_process->profile_manager()->GetProfileInfoCache(); | 427 g_browser_process->profile_manager()->GetProfileInfoCache(); |
426 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 428 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
427 if (existing_supervised_user_id == | 429 if (existing_supervised_user_id == |
428 cache.GetSupervisedUserIdOfProfileAtIndex(i)) | 430 cache.GetSupervisedUserIdOfProfileAtIndex(i)) |
429 return false; | 431 return false; |
430 } | 432 } |
431 return true; | 433 return true; |
432 } | 434 } |
433 | 435 |
434 } // namespace options | 436 } // namespace options |
OLD | NEW |