| 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 "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 bool control_or_command, | 477 bool control_or_command, |
| 478 bool caps_lock) { | 478 bool caps_lock) { |
| 479 bool control = control_or_command; | 479 bool control = control_or_command; |
| 480 bool command = false; | 480 bool command = false; |
| 481 | 481 |
| 482 // By default, swap control and command for native events on Mac. This | 482 // By default, swap control and command for native events on Mac. This |
| 483 // handles most cases. | 483 // handles most cases. |
| 484 if (TestingNativeMac()) | 484 if (TestingNativeMac()) |
| 485 std::swap(control, command); | 485 std::swap(control, command); |
| 486 | 486 |
| 487 int flags = (alt ? ui::EF_ALT_DOWN : 0) | (shift ? ui::EF_SHIFT_DOWN : 0) | | 487 int flags = (shift ? ui::EF_SHIFT_DOWN : 0) | |
| 488 (control ? ui::EF_CONTROL_DOWN : 0) | | 488 (control ? ui::EF_CONTROL_DOWN : 0) | |
| 489 (alt ? ui::EF_ALT_DOWN : 0) | |
| 489 (command ? ui::EF_COMMAND_DOWN : 0) | | 490 (command ? ui::EF_COMMAND_DOWN : 0) | |
| 490 (caps_lock ? ui::EF_CAPS_LOCK_DOWN : 0); | 491 (caps_lock ? ui::EF_CAPS_LOCK_ON : 0); |
| 491 | 492 |
| 492 SendKeyPress(key_code, flags); | 493 SendKeyPress(key_code, flags); |
| 493 } | 494 } |
| 494 | 495 |
| 495 void SendKeyEvent(ui::KeyboardCode key_code, | 496 void SendKeyEvent(ui::KeyboardCode key_code, |
| 496 bool shift, | 497 bool shift, |
| 497 bool control_or_command) { | 498 bool control_or_command) { |
| 498 SendKeyEvent(key_code, false, shift, control_or_command, false); | 499 SendKeyEvent(key_code, false, shift, control_or_command, false); |
| 499 } | 500 } |
| 500 | 501 |
| (...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2570 | 2571 |
| 2571 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); | 2572 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); |
| 2572 ui::AXViewState state_protected; | 2573 ui::AXViewState state_protected; |
| 2573 textfield_->GetAccessibleState(&state_protected); | 2574 textfield_->GetAccessibleState(&state_protected); |
| 2574 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); | 2575 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); |
| 2575 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); | 2576 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); |
| 2576 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); | 2577 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); |
| 2577 } | 2578 } |
| 2578 | 2579 |
| 2579 } // namespace views | 2580 } // namespace views |
| OLD | NEW |