| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 profile_creation_type_ = NO_CREATION_IN_PROGRESS; | 223 profile_creation_type_ = NO_CREATION_IN_PROGRESS; |
| 224 } | 224 } |
| 225 | 225 |
| 226 void CreateProfileHandler::ShowProfileCreationError( | 226 void CreateProfileHandler::ShowProfileCreationError( |
| 227 Profile* profile, | 227 Profile* profile, |
| 228 const base::string16& error) { | 228 const base::string16& error) { |
| 229 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_); | 229 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_); |
| 230 profile_creation_type_ = NO_CREATION_IN_PROGRESS; | 230 profile_creation_type_ = NO_CREATION_IN_PROGRESS; |
| 231 profile_path_being_created_.clear(); | 231 profile_path_being_created_.clear(); |
| 232 web_ui()->CallJavascriptFunctionUnsafe( | 232 web_ui()->CallJavascriptFunctionUnsafe( |
| 233 GetJavascriptMethodName(PROFILE_CREATION_ERROR), | 233 GetJavascriptMethodName(PROFILE_CREATION_ERROR), base::Value(error)); |
| 234 base::StringValue(error)); | |
| 235 // The ProfileManager calls us back with a NULL profile in some cases. | 234 // The ProfileManager calls us back with a NULL profile in some cases. |
| 236 if (profile) { | 235 if (profile) { |
| 237 webui::DeleteProfileAtPath(profile->GetPath(), | 236 webui::DeleteProfileAtPath(profile->GetPath(), |
| 238 web_ui(), | 237 web_ui(), |
| 239 ProfileMetrics::DELETE_PROFILE_SETTINGS); | 238 ProfileMetrics::DELETE_PROFILE_SETTINGS); |
| 240 } | 239 } |
| 241 } | 240 } |
| 242 | 241 |
| 243 void CreateProfileHandler::RecordProfileCreationMetrics( | 242 void CreateProfileHandler::RecordProfileCreationMetrics( |
| 244 Profile::CreateStatus status) { | 243 Profile::CreateStatus status) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } else { | 426 } else { |
| 428 error_msg = GetProfileCreationErrorMessageRemote(); | 427 error_msg = GetProfileCreationErrorMessageRemote(); |
| 429 } | 428 } |
| 430 ShowProfileCreationError(profile, error_msg); | 429 ShowProfileCreationError(profile, error_msg); |
| 431 } | 430 } |
| 432 | 431 |
| 433 void CreateProfileHandler::ShowProfileCreationWarning( | 432 void CreateProfileHandler::ShowProfileCreationWarning( |
| 434 const base::string16& warning) { | 433 const base::string16& warning) { |
| 435 DCHECK_EQ(SUPERVISED_PROFILE_CREATION, profile_creation_type_); | 434 DCHECK_EQ(SUPERVISED_PROFILE_CREATION, profile_creation_type_); |
| 436 web_ui()->CallJavascriptFunctionUnsafe( | 435 web_ui()->CallJavascriptFunctionUnsafe( |
| 437 "BrowserOptions.showCreateProfileWarning", base::StringValue(warning)); | 436 "BrowserOptions.showCreateProfileWarning", base::Value(warning)); |
| 438 } | 437 } |
| 439 | 438 |
| 440 void CreateProfileHandler::RecordSupervisedProfileCreationMetrics( | 439 void CreateProfileHandler::RecordSupervisedProfileCreationMetrics( |
| 441 GoogleServiceAuthError::State error_state) { | 440 GoogleServiceAuthError::State error_state) { |
| 442 if (profile_creation_type_ == SUPERVISED_PROFILE_CREATION) { | 441 if (profile_creation_type_ == SUPERVISED_PROFILE_CREATION) { |
| 443 UMA_HISTOGRAM_ENUMERATION("Profile.SupervisedProfileCreateError", | 442 UMA_HISTOGRAM_ENUMERATION("Profile.SupervisedProfileCreateError", |
| 444 error_state, | 443 error_state, |
| 445 GoogleServiceAuthError::NUM_STATES); | 444 GoogleServiceAuthError::NUM_STATES); |
| 446 UMA_HISTOGRAM_MEDIUM_TIMES( | 445 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 447 "Profile.SupervisedProfileTotalCreateTime", | 446 "Profile.SupervisedProfileTotalCreateTime", |
| (...skipping 27 matching lines...) Expand all Loading... |
| 475 GetProfileAttributesStorage().GetAllProfilesAttributes(); | 474 GetProfileAttributesStorage().GetAllProfilesAttributes(); |
| 476 for (const ProfileAttributesEntry* entry : entries) { | 475 for (const ProfileAttributesEntry* entry : entries) { |
| 477 if (existing_supervised_user_id == entry->GetSupervisedUserId()) | 476 if (existing_supervised_user_id == entry->GetSupervisedUserId()) |
| 478 return false; | 477 return false; |
| 479 } | 478 } |
| 480 return true; | 479 return true; |
| 481 } | 480 } |
| 482 #endif | 481 #endif |
| 483 | 482 |
| 484 } // namespace options | 483 } // namespace options |
| OLD | NEW |