Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Side by Side Diff: ash/virtual_keyboard_controller.h

Issue 2445293002: Make the virtual keyboard show up on the display with input focus. (Closed)
Patch Set: rebase & update Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef ASH_VIRTUAL_KEYBOARD_CONTROLLER_H_ 5 #ifndef ASH_VIRTUAL_KEYBOARD_CONTROLLER_H_
6 #define ASH_VIRTUAL_KEYBOARD_CONTROLLER_H_ 6 #define ASH_VIRTUAL_KEYBOARD_CONTROLLER_H_
7 7
8 #include <stdint.h>
9
8 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
9 #include "ash/common/shell_observer.h" 11 #include "ash/common/shell_observer.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "ui/events/devices/input_device_event_observer.h" 13 #include "ui/events/devices/input_device_event_observer.h"
14 #include "ui/keyboard/keyboard_layout_delegate.h"
12 15
13 namespace ash { 16 namespace ash {
14 17
15 // This class observes input device changes for the virtual keyboard. 18 // This class observes input device changes for the virtual keyboard.
16 class ASH_EXPORT VirtualKeyboardController 19 class ASH_EXPORT VirtualKeyboardController
17 : public ShellObserver, 20 : public ShellObserver,
18 public ui::InputDeviceEventObserver { 21 public ui::InputDeviceEventObserver,
22 public keyboard::KeyboardLayoutDelegate {
19 public: 23 public:
20 VirtualKeyboardController(); 24 VirtualKeyboardController();
21 ~VirtualKeyboardController() override; 25 ~VirtualKeyboardController() override;
22 26
23 // ShellObserver: 27 // ShellObserver:
24 // TODO(rsadam@): Remove when autovirtual keyboard flag is on by default. 28 // TODO(rsadam@): Remove when autovirtual keyboard flag is on by default.
25 void OnMaximizeModeStarted() override; 29 void OnMaximizeModeStarted() override;
26 void OnMaximizeModeEnded() override; 30 void OnMaximizeModeEnded() override;
27 31
28 // ui::InputDeviceObserver: 32 // ui::InputDeviceObserver:
29 void OnTouchscreenDeviceConfigurationChanged() override; 33 void OnTouchscreenDeviceConfigurationChanged() override;
30 void OnKeyboardDeviceConfigurationChanged() override; 34 void OnKeyboardDeviceConfigurationChanged() override;
31 35
32 // Toggles whether the presense of an external keyboard should be ignored 36 // Toggles whether the presense of an external keyboard should be ignored
33 // when determining whether or not to show the on-screen keyboard. 37 // when determining whether or not to show the on-screen keyboard.
34 void ToggleIgnoreExternalKeyboard(); 38 void ToggleIgnoreExternalKeyboard();
35 39
40 // keyboard::KeyboardLayoutDelegate
41 void MoveKeyboardToAnotherDisplayIfNeeded(int64_t display_id) override;
42
36 private: 43 private:
37 // Updates the list of active input devices. 44 // Updates the list of active input devices.
38 void UpdateDevices(); 45 void UpdateDevices();
39 46
40 // Updates the keyboard state. 47 // Updates the keyboard state.
41 void UpdateKeyboardEnabled(); 48 void UpdateKeyboardEnabled();
42 49
43 // Creates the keyboard if |enabled|, else destroys it. 50 // Creates the keyboard if |enabled|, else destroys it.
44 void SetKeyboardEnabled(bool enabled); 51 void SetKeyboardEnabled(bool enabled);
45 52
53 void MoveKeyboardToFirstTouchableDisplay() const;
54
46 // True if an external keyboard is connected. 55 // True if an external keyboard is connected.
47 bool has_external_keyboard_; 56 bool has_external_keyboard_;
48 // True if an internal keyboard is connected. 57 // True if an internal keyboard is connected.
49 bool has_internal_keyboard_; 58 bool has_internal_keyboard_;
50 // True if a touchscreen is connected. 59 // True if a touchscreen is connected.
51 bool has_touchscreen_; 60 bool has_touchscreen_;
52 // True if the presense of an external keyboard should be ignored. 61 // True if the presense of an external keyboard should be ignored.
53 bool ignore_external_keyboard_; 62 bool ignore_external_keyboard_;
54 63
55 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardController); 64 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardController);
56 }; 65 };
57 66
58 } // namespace ash 67 } // namespace ash
59 68
60 #endif // ASH_VIRTUAL_KEYBOARD_CONTROLLER_H_ 69 #endif // ASH_VIRTUAL_KEYBOARD_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698