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

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: alexei nits. unfortunately a rebase sneaked in :( 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
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('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 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/lifetime/application_lifetime.h" 10 #include "chrome/browser/lifetime/application_lifetime.h"
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender, 792 bool ProfileChooserView::HandleKeyEvent(views::Textfield* sender,
793 const ui::KeyEvent& key_event) { 793 const ui::KeyEvent& key_event) {
794 views::Textfield* name_textfield = 794 views::Textfield* name_textfield =
795 current_profile_name_->profile_name_textfield(); 795 current_profile_name_->profile_name_textfield();
796 DCHECK(sender == name_textfield); 796 DCHECK(sender == name_textfield);
797 797
798 if (key_event.key_code() == ui::VKEY_RETURN || 798 if (key_event.key_code() == ui::VKEY_RETURN ||
799 key_event.key_code() == ui::VKEY_TAB) { 799 key_event.key_code() == ui::VKEY_TAB) {
800 // Pressing Tab/Enter commits the new profile name, unless it's empty. 800 // Pressing Tab/Enter commits the new profile name, unless it's empty.
801 base::string16 new_profile_name = name_textfield->text(); 801 base::string16 new_profile_name = name_textfield->text();
802 base::TrimWhitespace(new_profile_name, base::TRIM_ALL, &new_profile_name);
802 if (new_profile_name.empty()) 803 if (new_profile_name.empty())
803 return true; 804 return true;
804 805
805 const AvatarMenu::Item& active_item = avatar_menu_->GetItemAt( 806 const AvatarMenu::Item& active_item = avatar_menu_->GetItemAt(
806 avatar_menu_->GetActiveProfileIndex()); 807 avatar_menu_->GetActiveProfileIndex());
807 Profile* profile = g_browser_process->profile_manager()->GetProfile( 808 Profile* profile = g_browser_process->profile_manager()->GetProfile(
808 active_item.profile_path); 809 active_item.profile_path);
809 DCHECK(profile); 810 DCHECK(profile);
810 811
811 if (profile->IsSupervised()) 812 if (profile->IsSupervised())
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 1499 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
1499 IncognitoModePrefs::DISABLED; 1500 IncognitoModePrefs::DISABLED;
1500 return incognito_available && !browser_->profile()->IsGuestSession(); 1501 return incognito_available && !browser_->profile()->IsGuestSession();
1501 } 1502 }
1502 1503
1503 void ProfileChooserView::PostActionPerformed( 1504 void ProfileChooserView::PostActionPerformed(
1504 ProfileMetrics::ProfileDesktopMenu action_performed) { 1505 ProfileMetrics::ProfileDesktopMenu action_performed) {
1505 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); 1506 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_);
1506 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; 1507 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE;
1507 } 1508 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698