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