OLD | NEW |
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 "ui/views/controls/textfield/native_textfield_views.h" | 5 #include "ui/views/controls/textfield/native_textfield_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 if (key_event.type() == ui::ET_KEY_PRESSED) { | 1183 if (key_event.type() == ui::ET_KEY_PRESSED) { |
1184 ui::KeyboardCode key_code = key_event.key_code(); | 1184 ui::KeyboardCode key_code = key_event.key_code(); |
1185 if (key_code == ui::VKEY_TAB || key_event.IsUnicodeKeyCode()) | 1185 if (key_code == ui::VKEY_TAB || key_event.IsUnicodeKeyCode()) |
1186 return false; | 1186 return false; |
1187 | 1187 |
1188 OnBeforeUserAction(); | 1188 OnBeforeUserAction(); |
1189 const bool editable = !textfield_->read_only(); | 1189 const bool editable = !textfield_->read_only(); |
1190 const bool readable = !textfield_->IsObscured(); | 1190 const bool readable = !textfield_->IsObscured(); |
1191 const bool shift = key_event.IsShiftDown(); | 1191 const bool shift = key_event.IsShiftDown(); |
1192 const bool control = key_event.IsControlDown(); | 1192 const bool control = key_event.IsControlDown(); |
1193 const bool alt = key_event.IsAltDown(); | 1193 const bool alt = key_event.IsAltDown() || key_event.IsAltGrDown(); |
1194 bool text_changed = false; | 1194 bool text_changed = false; |
1195 bool cursor_changed = false; | 1195 bool cursor_changed = false; |
1196 switch (key_code) { | 1196 switch (key_code) { |
1197 case ui::VKEY_Z: | 1197 case ui::VKEY_Z: |
1198 if (control && !shift && !alt && editable) | 1198 if (control && !shift && !alt && editable) |
1199 cursor_changed = text_changed = model_->Undo(); | 1199 cursor_changed = text_changed = model_->Undo(); |
1200 else if (control && shift && !alt && editable) | 1200 else if (control && shift && !alt && editable) |
1201 cursor_changed = text_changed = model_->Redo(); | 1201 cursor_changed = text_changed = model_->Redo(); |
1202 break; | 1202 break; |
1203 case ui::VKEY_Y: | 1203 case ui::VKEY_Y: |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 if (index != -1) { | 1518 if (index != -1) { |
1519 obscured_reveal_timer_.Start( | 1519 obscured_reveal_timer_.Start( |
1520 FROM_HERE, | 1520 FROM_HERE, |
1521 duration, | 1521 duration, |
1522 base::Bind(&NativeTextfieldViews::RevealObscuredChar, | 1522 base::Bind(&NativeTextfieldViews::RevealObscuredChar, |
1523 base::Unretained(this), -1, base::TimeDelta())); | 1523 base::Unretained(this), -1, base::TimeDelta())); |
1524 } | 1524 } |
1525 } | 1525 } |
1526 | 1526 |
1527 } // namespace views | 1527 } // namespace views |
OLD | NEW |