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

Side by Side Diff: chrome/browser/ui/webui/options/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 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 void CreateProfileHandler::ShowProfileCreationError( 225 void CreateProfileHandler::ShowProfileCreationError(
226 Profile* profile, 226 Profile* profile,
227 const base::string16& error) { 227 const base::string16& error) {
228 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_); 228 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_);
229 profile_creation_type_ = NO_CREATION_IN_PROGRESS; 229 profile_creation_type_ = NO_CREATION_IN_PROGRESS;
230 profile_path_being_created_.clear(); 230 profile_path_being_created_.clear();
231 web_ui()->CallJavascriptFunction( 231 web_ui()->CallJavascriptFunction(
232 GetJavascriptMethodName(PROFILE_CREATION_ERROR), 232 GetJavascriptMethodName(PROFILE_CREATION_ERROR),
233 base::StringValue(error)); 233 base::StringValue(error));
234 // 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.
235 if (profile) 235 if (profile) {
236 webui::DeleteProfileAtPath(profile->GetPath(), web_ui()); 236 webui::DeleteProfileAtPath(profile->GetPath(),
237 web_ui(),
238 ProfileMetrics::DELETE_PROFILE_SETTINGS);
239 }
237 } 240 }
238 241
239 void CreateProfileHandler::RecordProfileCreationMetrics( 242 void CreateProfileHandler::RecordProfileCreationMetrics(
240 Profile::CreateStatus status) { 243 Profile::CreateStatus status) {
241 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult", 244 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult",
242 status, 245 status,
243 Profile::MAX_CREATE_STATUS); 246 Profile::MAX_CREATE_STATUS);
244 UMA_HISTOGRAM_MEDIUM_TIMES( 247 UMA_HISTOGRAM_MEDIUM_TIMES(
245 "Profile.CreateTimeNoTimeout", 248 "Profile.CreateTimeNoTimeout",
246 base::TimeTicks::Now() - profile_creation_start_time_); 249 base::TimeTicks::Now() - profile_creation_start_time_);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 base::TimeTicks::Now() - profile_creation_start_time_); 370 base::TimeTicks::Now() - profile_creation_start_time_);
368 RecordProfileCreationMetrics(Profile::CREATE_STATUS_CANCELED); 371 RecordProfileCreationMetrics(Profile::CREATE_STATUS_CANCELED);
369 } 372 }
370 373
371 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_); 374 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_);
372 profile_creation_type_ = NO_CREATION_IN_PROGRESS; 375 profile_creation_type_ = NO_CREATION_IN_PROGRESS;
373 376
374 // Cancelling registration means the callback passed into 377 // Cancelling registration means the callback passed into
375 // RegisterAndInitSync() won't be called, so the cleanup must be done here. 378 // RegisterAndInitSync() won't be called, so the cleanup must be done here.
376 profile_path_being_created_.clear(); 379 profile_path_being_created_.clear();
377 webui::DeleteProfileAtPath(new_profile->GetPath(), web_ui()); 380 webui::DeleteProfileAtPath(new_profile->GetPath(),
381 web_ui(),
382 ProfileMetrics::DELETE_PROFILE_SETTINGS);
378 } 383 }
379 384
380 void CreateProfileHandler::RegisterSupervisedUser( 385 void CreateProfileHandler::RegisterSupervisedUser(
381 bool create_shortcut, 386 bool create_shortcut,
382 const std::string& supervised_user_id, 387 const std::string& supervised_user_id,
383 Profile* new_profile) { 388 Profile* new_profile) {
384 DCHECK_EQ(profile_path_being_created_.value(), 389 DCHECK_EQ(profile_path_being_created_.value(),
385 new_profile->GetPath().value()); 390 new_profile->GetPath().value());
386 391
387 SupervisedUserService* supervised_user_service = 392 SupervisedUserService* supervised_user_service =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 GetProfileAttributesStorage().GetAllProfilesAttributes(); 473 GetProfileAttributesStorage().GetAllProfilesAttributes();
469 for (const ProfileAttributesEntry* entry : entries) { 474 for (const ProfileAttributesEntry* entry : entries) {
470 if (existing_supervised_user_id == entry->GetSupervisedUserId()) 475 if (existing_supervised_user_id == entry->GetSupervisedUserId())
471 return false; 476 return false;
472 } 477 }
473 return true; 478 return true;
474 } 479 }
475 #endif 480 #endif
476 481
477 } // namespace options 482 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.cc ('k') | chrome/browser/ui/webui/options/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698