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 "ash/virtual_keyboard_controller.h" | 5 #include "ash/virtual_keyboard_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 | 68 |
69 // Checks for touchscreens. | 69 // Checks for touchscreens. |
70 has_touchscreen_ = device_data_manager->touchscreen_devices().size() > 0; | 70 has_touchscreen_ = device_data_manager->touchscreen_devices().size() > 0; |
71 | 71 |
72 // Checks for keyboards. | 72 // Checks for keyboards. |
73 has_external_keyboard_ = false; | 73 has_external_keyboard_ = false; |
74 has_internal_keyboard_ = false; | 74 has_internal_keyboard_ = false; |
75 std::vector<ui::KeyboardDevice> keyboards = | 75 std::vector<ui::KeyboardDevice> keyboards = |
76 device_data_manager->keyboard_devices(); | 76 device_data_manager->keyboard_devices(); |
77 for (auto iter = keyboards.begin(); | 77 for (auto iter = keyboards.begin(); |
78 iter != keyboards.end() || | 78 iter != keyboards.end() && |
79 (has_internal_keyboard_ && has_external_keyboard_); | 79 (!has_internal_keyboard_ || !has_external_keyboard_); |
80 ++iter) { | 80 ++iter) { |
oshima
2014/11/05 01:34:37
how about
for (ui::KeyboardDevice* device : keybo
rsadam
2014/11/05 01:42:32
NInja complains if I make it a pointer, other than
| |
81 ui::InputDeviceType type = (*iter).type; | 81 ui::InputDeviceType type = (*iter).type; |
82 if (type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL) | 82 if (type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL) |
83 has_internal_keyboard_ = true; | 83 has_internal_keyboard_ = true; |
84 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) | 84 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) |
85 has_external_keyboard_ = true; | 85 has_external_keyboard_ = true; |
86 } | 86 } |
87 // Update keyboard state. | 87 // Update keyboard state. |
88 UpdateKeyboardEnabled(); | 88 UpdateKeyboardEnabled(); |
89 } | 89 } |
90 | 90 |
(...skipping 18 matching lines...) Expand all Loading... | |
109 keyboard::SetTouchKeyboardEnabled(enabled); | 109 keyboard::SetTouchKeyboardEnabled(enabled); |
110 if (enabled) { | 110 if (enabled) { |
111 Shell::GetInstance()->CreateKeyboard(); | 111 Shell::GetInstance()->CreateKeyboard(); |
112 } else { | 112 } else { |
113 if (!keyboard::IsKeyboardEnabled()) | 113 if (!keyboard::IsKeyboardEnabled()) |
114 Shell::GetInstance()->DeactivateKeyboard(); | 114 Shell::GetInstance()->DeactivateKeyboard(); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 } // namespace ash | 118 } // namespace ash |
OLD | NEW |