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

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 474123002: [Mac, Win] Don't allow blank spaces in profile names in the new avatar bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use TrimWhitespace ftw Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/views/profiles/profile_chooser_view.h" 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/first_run/first_run.h" 10 #include "chrome/browser/first_run/first_run.h"
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, 793 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender,
794 const ui::KeyEvent& key_event) { 794 const ui::KeyEvent& key_event) {
795 views::Textfield* name_textfield = 795 views::Textfield* name_textfield =
796 current_profile_name_->profile_name_textfield(); 796 current_profile_name_->profile_name_textfield();
797 DCHECK(sender == name_textfield); 797 DCHECK(sender == name_textfield);
798 798
799 if (key_event.key_code() == ui::VKEY_RETURN || 799 if (key_event.key_code() == ui::VKEY_RETURN ||
800 key_event.key_code() == ui::VKEY_TAB) { 800 key_event.key_code() == ui::VKEY_TAB) {
801 // Pressing Tab/Enter commits the new profile name, unless it's empty. 801 // Pressing Tab/Enter commits the new profile name, unless it's empty.
802 base::string16 new_profile_name = name_textfield->text(); 802 base::string16 new_profile_name = name_textfield->text();
803 base::TrimWhitespace(new_profile_name, base::TRIM_ALL, &new_profile_name);
803 if (new_profile_name.empty()) 804 if (new_profile_name.empty())
804 return true; 805 return true;
805 806
806 const AvatarMenu::Item& active_item = avatar_menu_->GetItemAt( 807 const AvatarMenu::Item& active_item = avatar_menu_->GetItemAt(
807 avatar_menu_->GetActiveProfileIndex()); 808 avatar_menu_->GetActiveProfileIndex());
808 Profile* profile = g_browser_process->profile_manager()->GetProfile( 809 Profile* profile = g_browser_process->profile_manager()->GetProfile(
809 active_item.profile_path); 810 active_item.profile_path);
810 DCHECK(profile); 811 DCHECK(profile);
811 812
812 if (profile->IsSupervised()) 813 if (profile->IsSupervised())
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1498 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1498 IncognitoModePrefs::DISABLED; 1499 IncognitoModePrefs::DISABLED;
1499 return incognito_available && !browser_->profile()->IsGuestSession(); 1500 return incognito_available && !browser_->profile()->IsGuestSession();
1500 } 1501 }
1501 1502
1502 void ProfileChooserView::PostActionPerformed( 1503 void ProfileChooserView::PostActionPerformed(
1503 ProfileMetrics::ProfileDesktopMenu action_performed) { 1504 ProfileMetrics::ProfileDesktopMenu action_performed) {
1504 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1505 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1505 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1506 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1506 } 1507 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698