OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_CHROMEOS_CROS_KEYBOARD_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_KEYBOARD_LIBRARY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_KEYBOARD_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_KEYBOARD_LIBRARY_H_ |
7 | 7 |
8 #include "cros/chromeos_keyboard.h" | 8 #include "cros/chromeos_keyboard.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 | 15 |
16 // This class handles the interaction with the ChromeOS keyboard library APIs. | 16 // This class handles the interaction with the ChromeOS keyboard library APIs. |
17 class KeyboardLibrary { | 17 class KeyboardLibrary { |
18 public: | 18 public: |
19 virtual ~KeyboardLibrary() {} | 19 virtual ~KeyboardLibrary() {} |
20 | 20 |
21 // Returns the current layout name like "us". On error, returns "". | 21 // Returns the current layout name like "us". On error, returns "". |
22 virtual std::string GetCurrentKeyboardLayoutName() const = 0; | 22 virtual std::string GetCurrentKeyboardLayoutName() const = 0; |
23 | 23 |
24 // Sets the current keyboard layout to |layout_name|. Returns true on | 24 // Sets the current keyboard layout to |layout_name|. Returns true on |
25 // success. | 25 // success. |
26 virtual bool SetCurrentKeyboardLayoutByName( | 26 virtual bool SetCurrentKeyboardLayoutByName( |
27 const std::string& layout_name) = 0; | 27 const std::string& layout_name) = 0; |
28 | 28 |
| 29 // Remaps modifier keys. Returns true on success. |
| 30 virtual bool RemapModifierKeys(const ModifierMap& modifier_map) = 0; |
| 31 |
29 // Gets whehter we have separate keyboard layout per window, or not. The | 32 // Gets whehter we have separate keyboard layout per window, or not. The |
30 // result is stored in |is_per_window|. Returns true on success. | 33 // result is stored in |is_per_window|. Returns true on success. |
31 virtual bool GetKeyboardLayoutPerWindow(bool* is_per_window) const = 0; | 34 virtual bool GetKeyboardLayoutPerWindow(bool* is_per_window) const = 0; |
32 | 35 |
33 // Sets whether we have separate keyboard layout per window, or not. If false | 36 // Sets whether we have separate keyboard layout per window, or not. If false |
34 // is given, the same keyboard layout will be shared for all applications. | 37 // is given, the same keyboard layout will be shared for all applications. |
35 // Returns true on success. | 38 // Returns true on success. |
36 virtual bool SetKeyboardLayoutPerWindow(bool is_per_window) = 0; | 39 virtual bool SetKeyboardLayoutPerWindow(bool is_per_window) = 0; |
37 }; | 40 }; |
38 | 41 |
39 class KeyboardLibraryImpl : public KeyboardLibrary { | 42 class KeyboardLibraryImpl : public KeyboardLibrary { |
40 public: | 43 public: |
41 KeyboardLibraryImpl() {} | 44 KeyboardLibraryImpl() {} |
42 virtual ~KeyboardLibraryImpl() {} | 45 virtual ~KeyboardLibraryImpl() {} |
43 | 46 |
44 // KeyboardLibrary overrides. | 47 // KeyboardLibrary overrides. |
45 virtual std::string GetCurrentKeyboardLayoutName() const; | 48 virtual std::string GetCurrentKeyboardLayoutName() const; |
46 virtual bool SetCurrentKeyboardLayoutByName(const std::string& layout_name); | 49 virtual bool SetCurrentKeyboardLayoutByName(const std::string& layout_name); |
| 50 virtual bool RemapModifierKeys(const ModifierMap& modifier_map); |
47 virtual bool GetKeyboardLayoutPerWindow(bool* is_per_window) const; | 51 virtual bool GetKeyboardLayoutPerWindow(bool* is_per_window) const; |
48 virtual bool SetKeyboardLayoutPerWindow(bool is_per_window); | 52 virtual bool SetKeyboardLayoutPerWindow(bool is_per_window); |
49 | 53 |
50 private: | 54 private: |
51 DISALLOW_COPY_AND_ASSIGN(KeyboardLibraryImpl); | 55 DISALLOW_COPY_AND_ASSIGN(KeyboardLibraryImpl); |
52 }; | 56 }; |
53 | 57 |
54 } // namespace chromeos | 58 } // namespace chromeos |
55 | 59 |
56 #endif // CHROME_BROWSER_CHROMEOS_CROS_KEYBOARD_LIBRARY_H_ | 60 #endif // CHROME_BROWSER_CHROMEOS_CROS_KEYBOARD_LIBRARY_H_ |
OLD | NEW |