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

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: DeleteProfileAtPath use MaybeScheduleProfileForDeletion 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)
Bernhard Bauer 2016/05/12 12:06:23 If the body is now more than one line, add braces.
420 webui::DeleteProfileAtPath(profile->GetPath(), web_ui()); 420 webui::DeleteProfileAtPath(profile->GetPath(),
421 web_ui(),
422 ProfileMetrics::DELETE_PROFILE_SETTINGS);
421 profile_creation_type_ = NO_CREATION_IN_PROGRESS; 423 profile_creation_type_ = NO_CREATION_IN_PROGRESS;
422 profile_path_being_created_.clear(); 424 profile_path_being_created_.clear();
423 } 425 }
424 426
425 void SigninCreateProfileHandler::RecordProfileCreationMetrics( 427 void SigninCreateProfileHandler::RecordProfileCreationMetrics(
426 Profile::CreateStatus status) { 428 Profile::CreateStatus status) {
427 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult", status, 429 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult", status,
428 Profile::MAX_CREATE_STATUS); 430 Profile::MAX_CREATE_STATUS);
429 UMA_HISTOGRAM_MEDIUM_TIMES( 431 UMA_HISTOGRAM_MEDIUM_TIMES(
430 "Profile.CreateTimeNoTimeout", 432 "Profile.CreateTimeNoTimeout",
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 base::TimeTicks::Now() - profile_creation_start_time_); 649 base::TimeTicks::Now() - profile_creation_start_time_);
648 RecordProfileCreationMetrics(Profile::CREATE_STATUS_CANCELED); 650 RecordProfileCreationMetrics(Profile::CREATE_STATUS_CANCELED);
649 } 651 }
650 652
651 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_); 653 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_);
652 profile_creation_type_ = NO_CREATION_IN_PROGRESS; 654 profile_creation_type_ = NO_CREATION_IN_PROGRESS;
653 655
654 // Canceling registration means the callback passed into 656 // Canceling registration means the callback passed into
655 // RegisterAndInitSync() won't be called, so the cleanup must be done here. 657 // RegisterAndInitSync() won't be called, so the cleanup must be done here.
656 profile_path_being_created_.clear(); 658 profile_path_being_created_.clear();
657 webui::DeleteProfileAtPath(new_profile->GetPath(), web_ui()); 659 webui::DeleteProfileAtPath(new_profile->GetPath(),
660 web_ui(),
661 ProfileMetrics::DELETE_PROFILE_SETTINGS);
658 } 662 }
659 663
660 void SigninCreateProfileHandler::RegisterSupervisedUser( 664 void SigninCreateProfileHandler::RegisterSupervisedUser(
661 bool create_shortcut, 665 bool create_shortcut,
662 const std::string& supervised_user_id, 666 const std::string& supervised_user_id,
663 Profile* custodian_profile, 667 Profile* custodian_profile,
664 Profile* new_profile) { 668 Profile* new_profile) {
665 DCHECK_EQ(profile_path_being_created_.value(), 669 DCHECK_EQ(profile_path_being_created_.value(),
666 new_profile->GetPath().value()); 670 new_profile->GetPath().value());
667 671
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 Profile* profile = g_browser_process->profile_manager()-> 749 Profile* profile = g_browser_process->profile_manager()->
746 GetProfileByPath(profile_file_path); 750 GetProfileByPath(profile_file_path);
747 DCHECK(profile); 751 DCHECK(profile);
748 752
749 profiles::FindOrCreateNewWindowForProfile( 753 profiles::FindOrCreateNewWindowForProfile(
750 profile, chrome::startup::IS_PROCESS_STARTUP, 754 profile, chrome::startup::IS_PROCESS_STARTUP,
751 chrome::startup::IS_FIRST_RUN, false); 755 chrome::startup::IS_FIRST_RUN, false);
752 } 756 }
753 757
754 #endif 758 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698