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

Side by Side Diff: chrome/browser/ui/webui/signin/signin_create_profile_handler.cc

Issue 1869473002: Fixed crash on double profile delete operation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: param renaming. Created 4 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/signin/signin_create_profile_handler.h" 5 #include "chrome/browser/ui/webui/signin/signin_create_profile_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 409 }
410 410
411 void SigninCreateProfileHandler::ShowProfileCreationError( 411 void SigninCreateProfileHandler::ShowProfileCreationError(
412 Profile* profile, 412 Profile* profile,
413 const base::string16& error) { 413 const base::string16& error) {
414 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_); 414 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_);
415 web_ui()->CallJavascriptFunction("cr.webUIListenerCallback", 415 web_ui()->CallJavascriptFunction("cr.webUIListenerCallback",
416 GetWebUIListenerName(PROFILE_CREATION_ERROR), 416 GetWebUIListenerName(PROFILE_CREATION_ERROR),
417 base::StringValue(error)); 417 base::StringValue(error));
418 // The ProfileManager calls us back with a NULL profile in some cases. 418 // The ProfileManager calls us back with a NULL profile in some cases.
419 if (profile) 419 if (profile) {
420 webui::DeleteProfileAtPath(profile->GetPath(), web_ui()); 420 webui::DeleteProfileAtPath(profile->GetPath(),
421 web_ui(),
422 ProfileMetrics::DELETE_PROFILE_SETTINGS);
423 }
421 profile_creation_type_ = NO_CREATION_IN_PROGRESS; 424 profile_creation_type_ = NO_CREATION_IN_PROGRESS;
422 profile_path_being_created_.clear(); 425 profile_path_being_created_.clear();
423 } 426 }
424 427
425 void SigninCreateProfileHandler::RecordProfileCreationMetrics( 428 void SigninCreateProfileHandler::RecordProfileCreationMetrics(
426 Profile::CreateStatus status) { 429 Profile::CreateStatus status) {
427 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult", status, 430 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult", status,
428 Profile::MAX_CREATE_STATUS); 431 Profile::MAX_CREATE_STATUS);
429 UMA_HISTOGRAM_MEDIUM_TIMES( 432 UMA_HISTOGRAM_MEDIUM_TIMES(
430 "Profile.CreateTimeNoTimeout", 433 "Profile.CreateTimeNoTimeout",
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 base::TimeTicks::Now() - profile_creation_start_time_); 650 base::TimeTicks::Now() - profile_creation_start_time_);
648 RecordProfileCreationMetrics(Profile::CREATE_STATUS_CANCELED); 651 RecordProfileCreationMetrics(Profile::CREATE_STATUS_CANCELED);
649 } 652 }
650 653
651 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_); 654 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_);
652 profile_creation_type_ = NO_CREATION_IN_PROGRESS; 655 profile_creation_type_ = NO_CREATION_IN_PROGRESS;
653 656
654 // Canceling registration means the callback passed into 657 // Canceling registration means the callback passed into
655 // RegisterAndInitSync() won't be called, so the cleanup must be done here. 658 // RegisterAndInitSync() won't be called, so the cleanup must be done here.
656 profile_path_being_created_.clear(); 659 profile_path_being_created_.clear();
657 webui::DeleteProfileAtPath(new_profile->GetPath(), web_ui()); 660 webui::DeleteProfileAtPath(new_profile->GetPath(),
661 web_ui(),
662 ProfileMetrics::DELETE_PROFILE_SETTINGS);
658 } 663 }
659 664
660 void SigninCreateProfileHandler::RegisterSupervisedUser( 665 void SigninCreateProfileHandler::RegisterSupervisedUser(
661 bool create_shortcut, 666 bool create_shortcut,
662 const std::string& supervised_user_id, 667 const std::string& supervised_user_id,
663 Profile* custodian_profile, 668 Profile* custodian_profile,
664 Profile* new_profile) { 669 Profile* new_profile) {
665 DCHECK_EQ(profile_path_being_created_.value(), 670 DCHECK_EQ(profile_path_being_created_.value(),
666 new_profile->GetPath().value()); 671 new_profile->GetPath().value());
667 672
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 Profile* profile = g_browser_process->profile_manager()-> 750 Profile* profile = g_browser_process->profile_manager()->
746 GetProfileByPath(profile_file_path); 751 GetProfileByPath(profile_file_path);
747 DCHECK(profile); 752 DCHECK(profile);
748 753
749 profiles::FindOrCreateNewWindowForProfile( 754 profiles::FindOrCreateNewWindowForProfile(
750 profile, chrome::startup::IS_PROCESS_STARTUP, 755 profile, chrome::startup::IS_PROCESS_STARTUP,
751 chrome::startup::IS_FIRST_RUN, false); 756 chrome::startup::IS_FIRST_RUN, false);
752 } 757 }
753 758
754 #endif 759 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/people_handler.cc ('k') | chrome/browser/ui/webui/signin/user_manager_screen_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698