OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 Profile::FromWebUI(web_ui()), | 1176 Profile::FromWebUI(web_ui()), |
1177 managed_user_id, | 1177 managed_user_id, |
1178 callback); | 1178 callback); |
1179 } | 1179 } |
1180 | 1180 |
1181 void BrowserOptionsHandler::RecordProfileCreationMetrics( | 1181 void BrowserOptionsHandler::RecordProfileCreationMetrics( |
1182 Profile::CreateStatus status) { | 1182 Profile::CreateStatus status) { |
1183 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult", | 1183 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult", |
1184 status, | 1184 status, |
1185 Profile::MAX_CREATE_STATUS); | 1185 Profile::MAX_CREATE_STATUS); |
1186 UMA_HISTOGRAM_CUSTOM_TIMES("Profile.CreateTime", | 1186 UMA_HISTOGRAM_MEDIUM_TIMES( |
1187 base::TimeTicks::Now() - profile_creation_start_time_, | 1187 "Profile.CreateTimeNoTimeout", |
1188 base::TimeDelta::FromMilliseconds(1), | 1188 base::TimeTicks::Now() - profile_creation_start_time_); |
1189 base::TimeDelta::FromSeconds(30), // From kRegistrationTimeoutMS. | |
1190 100); | |
1191 } | 1189 } |
1192 | 1190 |
1193 void BrowserOptionsHandler::ShowProfileCreationFeedback( | 1191 void BrowserOptionsHandler::ShowProfileCreationFeedback( |
1194 chrome::HostDesktopType desktop_type, | 1192 chrome::HostDesktopType desktop_type, |
1195 bool is_managed, | 1193 bool is_managed, |
1196 Profile* profile, | 1194 Profile* profile, |
1197 Profile::CreateStatus status) { | 1195 Profile::CreateStatus status) { |
1198 DCHECK(profile_path_being_created_ == profile->GetPath()); | 1196 DCHECK(profile_path_being_created_ == profile->GetPath()); |
1199 if (status != Profile::CREATE_STATUS_CREATED) | 1197 if (status != Profile::CREATE_STATUS_CREATED) |
1200 RecordProfileCreationMetrics(status); | 1198 RecordProfileCreationMetrics(status); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 if (!new_profile) | 1289 if (!new_profile) |
1292 return; | 1290 return; |
1293 | 1291 |
1294 // Non-managed user creation cannot be canceled. (Creating a non-managed | 1292 // Non-managed user creation cannot be canceled. (Creating a non-managed |
1295 // profile shouldn't take significant time, and it can easily be deleted | 1293 // profile shouldn't take significant time, and it can easily be deleted |
1296 // afterward.) | 1294 // afterward.) |
1297 if (!new_profile->IsManaged()) | 1295 if (!new_profile->IsManaged()) |
1298 return; | 1296 return; |
1299 | 1297 |
1300 if (user_initiated) { | 1298 if (user_initiated) { |
1301 UMA_HISTOGRAM_CUSTOM_TIMES("Profile.CreateTimeCanceled", | 1299 UMA_HISTOGRAM_MEDIUM_TIMES( |
1302 base::TimeTicks::Now() - profile_creation_start_time_, | 1300 "Profile.CreateTimeCanceledNoTimeout", |
1303 base::TimeDelta::FromMilliseconds(1), | 1301 base::TimeTicks::Now() - profile_creation_start_time_); |
1304 base::TimeDelta::FromSeconds(30), // From kRegistrationTimeoutMS. | |
1305 100); | |
1306 RecordProfileCreationMetrics(Profile::CREATE_STATUS_CANCELED); | 1302 RecordProfileCreationMetrics(Profile::CREATE_STATUS_CANCELED); |
1307 } | 1303 } |
1308 | 1304 |
1309 DCHECK(managed_user_registration_utility_.get()); | 1305 DCHECK(managed_user_registration_utility_.get()); |
1310 managed_user_registration_utility_.reset(); | 1306 managed_user_registration_utility_.reset(); |
1311 | 1307 |
1312 // Cancelling registration means the callback passed into | 1308 // Cancelling registration means the callback passed into |
1313 // RegisterAndInitSync() won't be called, so the cleanup must be done here. | 1309 // RegisterAndInitSync() won't be called, so the cleanup must be done here. |
1314 profile_path_being_created_.clear(); | 1310 profile_path_being_created_.clear(); |
1315 DeleteProfileAtPath(new_profile->GetPath()); | 1311 DeleteProfileAtPath(new_profile->GetPath()); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 const ProfileInfoCache& cache = | 1758 const ProfileInfoCache& cache = |
1763 g_browser_process->profile_manager()->GetProfileInfoCache(); | 1759 g_browser_process->profile_manager()->GetProfileInfoCache(); |
1764 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { | 1760 for (size_t i = 0; i < cache.GetNumberOfProfiles(); ++i) { |
1765 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) | 1761 if (existing_managed_user_id == cache.GetManagedUserIdOfProfileAtIndex(i)) |
1766 return false; | 1762 return false; |
1767 } | 1763 } |
1768 return true; | 1764 return true; |
1769 } | 1765 } |
1770 | 1766 |
1771 } // namespace options | 1767 } // namespace options |
OLD | NEW |