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

Side by Side Diff: chrome/browser/ui/webui/options/create_profile_handler.cc

Issue 2516613002: Profile deletion: prevent profile creation race in dying browser. (Closed)
Patch Set: Created 4 years, 1 month 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // the new window now. 211 // the new window now.
212 bool should_open_new_window = true; 212 bool should_open_new_window = true;
213 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) 213 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
214 if (profile_creation_type_ == SUPERVISED_PROFILE_CREATION) 214 if (profile_creation_type_ == SUPERVISED_PROFILE_CREATION)
215 should_open_new_window = false; 215 should_open_new_window = false;
216 #endif 216 #endif
217 217
218 if (should_open_new_window) { 218 if (should_open_new_window) {
219 // Opening the new window must be the last action, after all callbacks 219 // Opening the new window must be the last action, after all callbacks
220 // have been run, to give them a chance to initialize the profile. 220 // have been run, to give them a chance to initialize the profile.
221 webui::OpenNewWindowForProfile(profile, Profile::CREATE_STATUS_INITIALIZED); 221 webui::OpenNewWindowForProfile(nullptr, profile,
222 Profile::CREATE_STATUS_INITIALIZED);
222 } 223 }
223 profile_creation_type_ = NO_CREATION_IN_PROGRESS; 224 profile_creation_type_ = NO_CREATION_IN_PROGRESS;
224 } 225 }
225 226
226 void CreateProfileHandler::ShowProfileCreationError( 227 void CreateProfileHandler::ShowProfileCreationError(
227 Profile* profile, 228 Profile* profile,
228 const base::string16& error) { 229 const base::string16& error) {
229 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_); 230 DCHECK_NE(NO_CREATION_IN_PROGRESS, profile_creation_type_);
230 profile_creation_type_ = NO_CREATION_IN_PROGRESS; 231 profile_creation_type_ = NO_CREATION_IN_PROGRESS;
231 profile_path_being_created_.clear(); 232 profile_path_being_created_.clear();
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 GetProfileAttributesStorage().GetAllProfilesAttributes(); 476 GetProfileAttributesStorage().GetAllProfilesAttributes();
476 for (const ProfileAttributesEntry* entry : entries) { 477 for (const ProfileAttributesEntry* entry : entries) {
477 if (existing_supervised_user_id == entry->GetSupervisedUserId()) 478 if (existing_supervised_user_id == entry->GetSupervisedUserId())
478 return false; 479 return false;
479 } 480 }
480 return true; 481 return true;
481 } 482 }
482 #endif 483 #endif
483 484
484 } // namespace options 485 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698