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

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

Issue 562233002: Don't allow creating a profile with an empty name in chrome://settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added empty string checks Created 6 years, 3 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
« no previous file with comments | « chrome/browser/ui/webui/options/create_profile_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/manage_profile_handler.h" 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 ProfileMetrics::LogProfileUpdate(profile_file_path); 376 ProfileMetrics::LogProfileUpdate(profile_file_path);
377 377
378 if (profile->IsSupervised()) 378 if (profile->IsSupervised())
379 return; 379 return;
380 380
381 base::string16 new_profile_name; 381 base::string16 new_profile_name;
382 if (!args->GetString(2, &new_profile_name)) 382 if (!args->GetString(2, &new_profile_name))
383 return; 383 return;
384 384
385 base::TrimWhitespace(new_profile_name, base::TRIM_ALL, &new_profile_name); 385 base::TrimWhitespace(new_profile_name, base::TRIM_ALL, &new_profile_name);
386 CHECK(!new_profile_name.empty());
386 profiles::UpdateProfileName(profile, new_profile_name); 387 profiles::UpdateProfileName(profile, new_profile_name);
387 } 388 }
388 389
389 #if defined(ENABLE_SETTINGS_APP) 390 #if defined(ENABLE_SETTINGS_APP)
390 void ManageProfileHandler::SwitchAppListProfile(const base::ListValue* args) { 391 void ManageProfileHandler::SwitchAppListProfile(const base::ListValue* args) {
391 DCHECK(args); 392 DCHECK(args);
392 DCHECK(profiles::IsMultipleProfilesEnabled()); 393 DCHECK(profiles::IsMultipleProfilesEnabled());
393 394
394 const base::Value* file_path_value; 395 const base::Value* file_path_value;
395 base::FilePath profile_file_path; 396 base::FilePath profile_file_path;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 540
540 // Update the UI buttons. 541 // Update the UI buttons.
541 OnHasProfileShortcuts(false); 542 OnHasProfileShortcuts(false);
542 } 543 }
543 544
544 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { 545 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) {
545 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui())); 546 profiles::UpdateGaiaProfilePhotoIfNeeded(Profile::FromWebUI(web_ui()));
546 } 547 }
547 548
548 } // namespace options 549 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/create_profile_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698