Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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::TrimString(new_profile_name, base::ASCIIToUTF16(" "), | |
|
sky
2014/08/15 04:38:41
Might it be possible to get other characters in th
noms (inactive)
2014/08/15 13:32:41
But if you paste it in, isn't it still in the text
sky
2014/08/15 19:28:37
Exactly.
| |
| 804 &new_profile_name); | |
| 803 if (new_profile_name.empty()) | 805 if (new_profile_name.empty()) |
| 804 return true; | 806 return true; |
| 805 | 807 |
| 806 const AvatarMenu::Item& active_item = avatar_menu_->GetItemAt( | 808 const AvatarMenu::Item& active_item = avatar_menu_->GetItemAt( |
| 807 avatar_menu_->GetActiveProfileIndex()); | 809 avatar_menu_->GetActiveProfileIndex()); |
| 808 Profile* profile = g_browser_process->profile_manager()->GetProfile( | 810 Profile* profile = g_browser_process->profile_manager()->GetProfile( |
| 809 active_item.profile_path); | 811 active_item.profile_path); |
| 810 DCHECK(profile); | 812 DCHECK(profile); |
| 811 | 813 |
| 812 if (profile->IsSupervised()) | 814 if (profile->IsSupervised()) |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1497 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 1499 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 1498 IncognitoModePrefs::DISABLED; | 1500 IncognitoModePrefs::DISABLED; |
| 1499 return incognito_available && !browser_->profile()->IsGuestSession(); | 1501 return incognito_available && !browser_->profile()->IsGuestSession(); |
| 1500 } | 1502 } |
| 1501 | 1503 |
| 1502 void ProfileChooserView::PostActionPerformed( | 1504 void ProfileChooserView::PostActionPerformed( |
| 1503 ProfileMetrics::ProfileDesktopMenu action_performed) { | 1505 ProfileMetrics::ProfileDesktopMenu action_performed) { |
| 1504 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); | 1506 ProfileMetrics::LogProfileDesktopMenu(action_performed, gaia_service_type_); |
| 1505 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; | 1507 gaia_service_type_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 1506 } | 1508 } |
| OLD | NEW |