| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_INPUT_METHOD_VIRTUAL_KEYBOARD_SELECTOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_VIRTUAL_KEYBOARD_SELECTOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_VIRTUAL_KEYBOARD_SELECTOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_VIRTUAL_KEYBOARD_SELECTOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // Sets user preferences on virtual keyboard selection so that the virtual | 85 // Sets user preferences on virtual keyboard selection so that the virtual |
| 86 // keyboard extension specified by the |url| is always selected for the | 86 // keyboard extension specified by the |url| is always selected for the |
| 87 // |layout|. Returns false if a virtual keyboard extension whose address is | 87 // |layout|. Returns false if a virtual keyboard extension whose address is |
| 88 // |url| is not registered, or the extension specified by the |url| does not | 88 // |url| is not registered, or the extension specified by the |url| does not |
| 89 // support the |layout|. | 89 // support the |layout|. |
| 90 bool SetUserPreference(const std::string& layout, const GURL& url); | 90 bool SetUserPreference(const std::string& layout, const GURL& url); |
| 91 | 91 |
| 92 // Removes the preference for the |layout| added by SetUserPreference. | 92 // Removes the preference for the |layout| added by SetUserPreference. |
| 93 void RemoveUserPreference(const std::string& layout); | 93 void RemoveUserPreference(const std::string& layout); |
| 94 | 94 |
| 95 // Removes all preferences added by SetUserPreference. |
| 96 void ClearAllUserPreferences(); |
| 97 |
| 95 protected: | 98 protected: |
| 96 // Selects and returns the most suitable virtual keyboard extension for the | 99 // Selects and returns the most suitable virtual keyboard extension for the |
| 97 // |layout|. Unlike SelectVirtualKeyboard(), this function only scans | 100 // |layout|. Unlike SelectVirtualKeyboard(), this function only scans |
| 98 // |keyboards_| and |system_keyboards_| (in this order), and never updates | 101 // |keyboards_| and |system_keyboards_| (in this order), and never updates |
| 99 // |current_|. The function is protected for testability. | 102 // |current_|. The function is protected for testability. |
| 100 const VirtualKeyboard* SelectVirtualKeyboardWithoutPreferences( | 103 const VirtualKeyboard* SelectVirtualKeyboardWithoutPreferences( |
| 101 const std::string& layout); | 104 const std::string& layout); |
| 102 | 105 |
| 103 // The function is protected for testability. | 106 // The function is protected for testability. |
| 104 const std::map<std::string, const VirtualKeyboard*>& user_preference() const { | 107 const std::map<std::string, const VirtualKeyboard*>& user_preference() const { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 124 // SetUserPreference() faster. | 127 // SetUserPreference() faster. |
| 125 std::map<GURL, const VirtualKeyboard*> url_to_keyboard_; | 128 std::map<GURL, const VirtualKeyboard*> url_to_keyboard_; |
| 126 | 129 |
| 127 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardSelector); | 130 DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardSelector); |
| 128 }; | 131 }; |
| 129 | 132 |
| 130 } // namespace input_method | 133 } // namespace input_method |
| 131 } // namespace chromeos | 134 } // namespace chromeos |
| 132 | 135 |
| 133 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_VIRTUAL_KEYBOARD_SELECTOR_H_ | 136 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_VIRTUAL_KEYBOARD_SELECTOR_H_ |
| OLD | NEW |