OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROMEOS_IME_FAKE_INPUT_METHOD_DELEGATE_H_ | 5 #ifndef CHROMEOS_IME_FAKE_INPUT_METHOD_DELEGATE_H_ |
6 #define CHROMEOS_IME_FAKE_INPUT_METHOD_DELEGATE_H_ | 6 #define CHROMEOS_IME_FAKE_INPUT_METHOD_DELEGATE_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
11 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
12 #include "chromeos/ime/input_method_delegate.h" | 14 #include "chromeos/ime/input_method_delegate.h" |
13 | 15 |
14 namespace chromeos { | 16 namespace chromeos { |
15 namespace input_method { | 17 namespace input_method { |
16 | 18 |
17 class CHROMEOS_EXPORT FakeInputMethodDelegate : public InputMethodDelegate { | 19 class CHROMEOS_EXPORT FakeInputMethodDelegate : public InputMethodDelegate { |
18 public: | 20 public: |
19 typedef base::Callback<base::string16 (const std::string& language_code)> | 21 typedef base::Callback<base::string16 (const std::string& language_code)> |
20 LanguageNameLocalizationCallback; | 22 LanguageNameLocalizationCallback; |
21 typedef base::Callback<base::string16 (int resource_id)> | 23 typedef base::Callback<base::string16 (int resource_id)> |
22 GetLocalizedStringCallback; | 24 GetLocalizedStringCallback; |
23 | 25 |
24 FakeInputMethodDelegate(); | 26 FakeInputMethodDelegate(); |
25 virtual ~FakeInputMethodDelegate(); | 27 virtual ~FakeInputMethodDelegate(); |
26 | 28 |
27 // InputMethodDelegate implementation: | 29 // InputMethodDelegate implementation: |
28 virtual std::string GetHardwareKeyboardLayout() const OVERRIDE; | 30 virtual void GetHardwareKeyboardLayouts( |
| 31 std::vector<std::string>* out) const OVERRIDE; |
29 virtual base::string16 GetLocalizedString(int resource_id) const OVERRIDE; | 32 virtual base::string16 GetLocalizedString(int resource_id) const OVERRIDE; |
30 virtual base::string16 GetDisplayLanguageName( | 33 virtual base::string16 GetDisplayLanguageName( |
31 const std::string& language_code) const OVERRIDE; | 34 const std::string& language_code) const OVERRIDE; |
32 | 35 |
33 void set_hardware_keyboard_layout(const std::string& value) { | 36 void set_hardware_keyboard_layout(const std::vector<std::string>& value) { |
34 hardware_keyboard_layout_ = value; | 37 hardware_keyboard_layout_ = value; |
35 } | 38 } |
36 | 39 |
37 void set_active_locale(const std::string& value) { | 40 void set_active_locale(const std::string& value) { |
38 active_locale_ = value; | 41 active_locale_ = value; |
39 } | 42 } |
40 | 43 |
41 void set_get_display_language_name_callback( | 44 void set_get_display_language_name_callback( |
42 const LanguageNameLocalizationCallback& callback) { | 45 const LanguageNameLocalizationCallback& callback) { |
43 get_display_language_name_callback_ = callback; | 46 get_display_language_name_callback_ = callback; |
44 } | 47 } |
45 | 48 |
46 void set_get_localized_string_callback( | 49 void set_get_localized_string_callback( |
47 const GetLocalizedStringCallback& callback) { | 50 const GetLocalizedStringCallback& callback) { |
48 get_localized_string_callback_ = callback; | 51 get_localized_string_callback_ = callback; |
49 } | 52 } |
50 | 53 |
51 private: | 54 private: |
52 std::string hardware_keyboard_layout_; | 55 std::vector<std::string> hardware_keyboard_layout_; |
53 std::string active_locale_; | 56 std::string active_locale_; |
54 LanguageNameLocalizationCallback get_display_language_name_callback_; | 57 LanguageNameLocalizationCallback get_display_language_name_callback_; |
55 GetLocalizedStringCallback get_localized_string_callback_; | 58 GetLocalizedStringCallback get_localized_string_callback_; |
56 DISALLOW_COPY_AND_ASSIGN(FakeInputMethodDelegate); | 59 DISALLOW_COPY_AND_ASSIGN(FakeInputMethodDelegate); |
57 }; | 60 }; |
58 | 61 |
59 } // namespace input_method | 62 } // namespace input_method |
60 } // namespace chromeos | 63 } // namespace chromeos |
61 | 64 |
62 #endif // CHROMEOS_IME_FAKE_INPUT_METHOD_DELEGATE_H_ | 65 #endif // CHROMEOS_IME_FAKE_INPUT_METHOD_DELEGATE_H_ |
OLD | NEW |