OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MOCK_INPUT_METHOD_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
9 #include "chromeos/ime/component_extension_ime_manager.h" | 9 #include "chromeos/ime/component_extension_ime_manager.h" |
10 #include "chromeos/ime/fake_ime_keyboard.h" | 10 #include "chromeos/ime/fake_ime_keyboard.h" |
11 #include "chromeos/ime/fake_input_method_delegate.h" | 11 #include "chromeos/ime/fake_input_method_delegate.h" |
12 #include "chromeos/ime/input_method_manager.h" | 12 #include "chromeos/ime/input_method_manager.h" |
13 #include "chromeos/ime/input_method_whitelist.h" | 13 #include "chromeos/ime/input_method_whitelist.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 namespace input_method { | 16 namespace input_method { |
17 | 17 |
18 // The mock implementation of InputMethodManager for testing. | 18 // The mock implementation of InputMethodManager for testing. |
19 class MockInputMethodManager : public InputMethodManager { | 19 class MockInputMethodManager : public InputMethodManager { |
20 public: | 20 public: |
21 class State : public InputMethodManager::State { | 21 class State : public InputMethodManager::State { |
22 public: | 22 public: |
23 explicit State(MockInputMethodManager* manager); | 23 explicit State(MockInputMethodManager* manager); |
24 | 24 |
25 virtual scoped_refptr<InputMethodManager::State> Clone() const OVERRIDE; | 25 virtual scoped_refptr<InputMethodManager::State> Clone() const override; |
26 virtual void AddInputMethodExtension( | 26 virtual void AddInputMethodExtension( |
27 const std::string& extension_id, | 27 const std::string& extension_id, |
28 const InputMethodDescriptors& descriptors, | 28 const InputMethodDescriptors& descriptors, |
29 InputMethodEngineInterface* instance) OVERRIDE; | 29 InputMethodEngineInterface* instance) override; |
30 virtual void RemoveInputMethodExtension( | 30 virtual void RemoveInputMethodExtension( |
31 const std::string& extension_id) OVERRIDE; | 31 const std::string& extension_id) override; |
32 virtual void ChangeInputMethod(const std::string& input_method_id, | 32 virtual void ChangeInputMethod(const std::string& input_method_id, |
33 bool show_message) OVERRIDE; | 33 bool show_message) override; |
34 virtual bool EnableInputMethod( | 34 virtual bool EnableInputMethod( |
35 const std::string& new_active_input_method_id) OVERRIDE; | 35 const std::string& new_active_input_method_id) override; |
36 virtual void EnableLoginLayouts( | 36 virtual void EnableLoginLayouts( |
37 const std::string& language_code, | 37 const std::string& language_code, |
38 const std::vector<std::string>& initial_layouts) OVERRIDE; | 38 const std::vector<std::string>& initial_layouts) override; |
39 virtual void EnableLockScreenLayouts() OVERRIDE; | 39 virtual void EnableLockScreenLayouts() override; |
40 virtual void GetInputMethodExtensions( | 40 virtual void GetInputMethodExtensions( |
41 InputMethodDescriptors* result) OVERRIDE; | 41 InputMethodDescriptors* result) override; |
42 virtual scoped_ptr<InputMethodDescriptors> GetActiveInputMethods() | 42 virtual scoped_ptr<InputMethodDescriptors> GetActiveInputMethods() |
43 const OVERRIDE; | 43 const override; |
44 virtual const std::vector<std::string>& GetActiveInputMethodIds() | 44 virtual const std::vector<std::string>& GetActiveInputMethodIds() |
45 const OVERRIDE; | 45 const override; |
46 virtual const InputMethodDescriptor* GetInputMethodFromId( | 46 virtual const InputMethodDescriptor* GetInputMethodFromId( |
47 const std::string& input_method_id) const OVERRIDE; | 47 const std::string& input_method_id) const override; |
48 virtual size_t GetNumActiveInputMethods() const OVERRIDE; | 48 virtual size_t GetNumActiveInputMethods() const override; |
49 virtual void SetEnabledExtensionImes( | 49 virtual void SetEnabledExtensionImes( |
50 std::vector<std::string>* ids) OVERRIDE; | 50 std::vector<std::string>* ids) override; |
51 virtual void SetInputMethodLoginDefault() OVERRIDE; | 51 virtual void SetInputMethodLoginDefault() override; |
52 virtual void SetInputMethodLoginDefaultFromVPD( | 52 virtual void SetInputMethodLoginDefaultFromVPD( |
53 const std::string& locale, | 53 const std::string& locale, |
54 const std::string& layout) OVERRIDE; | 54 const std::string& layout) override; |
55 virtual bool SwitchToNextInputMethod() OVERRIDE; | 55 virtual bool SwitchToNextInputMethod() override; |
56 virtual bool SwitchToPreviousInputMethod( | 56 virtual bool SwitchToPreviousInputMethod( |
57 const ui::Accelerator& accelerator) OVERRIDE; | 57 const ui::Accelerator& accelerator) override; |
58 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) OVERRIDE; | 58 virtual bool SwitchInputMethod(const ui::Accelerator& accelerator) override; |
59 virtual InputMethodDescriptor GetCurrentInputMethod() const OVERRIDE; | 59 virtual InputMethodDescriptor GetCurrentInputMethod() const override; |
60 virtual bool ReplaceEnabledInputMethods( | 60 virtual bool ReplaceEnabledInputMethods( |
61 const std::vector<std::string>& new_active_input_method_ids) OVERRIDE; | 61 const std::vector<std::string>& new_active_input_method_ids) override; |
62 | 62 |
63 // The value GetCurrentInputMethod().id() will return. | 63 // The value GetCurrentInputMethod().id() will return. |
64 std::string current_input_method_id; | 64 std::string current_input_method_id; |
65 | 65 |
66 // The active input method ids cache (actually default only) | 66 // The active input method ids cache (actually default only) |
67 std::vector<std::string> active_input_method_ids; | 67 std::vector<std::string> active_input_method_ids; |
68 | 68 |
69 protected: | 69 protected: |
70 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>; | 70 friend base::RefCounted<chromeos::input_method::InputMethodManager::State>; |
71 virtual ~State(); | 71 virtual ~State(); |
72 | 72 |
73 MockInputMethodManager* const manager_; | 73 MockInputMethodManager* const manager_; |
74 }; | 74 }; |
75 | 75 |
76 MockInputMethodManager(); | 76 MockInputMethodManager(); |
77 virtual ~MockInputMethodManager(); | 77 virtual ~MockInputMethodManager(); |
78 | 78 |
79 // InputMethodManager override: | 79 // InputMethodManager override: |
80 virtual UISessionState GetUISessionState() OVERRIDE; | 80 virtual UISessionState GetUISessionState() override; |
81 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; | 81 virtual void AddObserver(InputMethodManager::Observer* observer) override; |
82 virtual void AddCandidateWindowObserver( | 82 virtual void AddCandidateWindowObserver( |
83 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; | 83 InputMethodManager::CandidateWindowObserver* observer) override; |
84 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; | 84 virtual void RemoveObserver(InputMethodManager::Observer* observer) override; |
85 virtual void RemoveCandidateWindowObserver( | 85 virtual void RemoveCandidateWindowObserver( |
86 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; | 86 InputMethodManager::CandidateWindowObserver* observer) override; |
87 virtual scoped_ptr<InputMethodDescriptors> | 87 virtual scoped_ptr<InputMethodDescriptors> |
88 GetSupportedInputMethods() const OVERRIDE; | 88 GetSupportedInputMethods() const override; |
89 virtual void ActivateInputMethodMenuItem(const std::string& key) OVERRIDE; | 89 virtual void ActivateInputMethodMenuItem(const std::string& key) override; |
90 virtual bool IsISOLevel5ShiftUsedByCurrentInputMethod() const OVERRIDE; | 90 virtual bool IsISOLevel5ShiftUsedByCurrentInputMethod() const override; |
91 virtual bool IsAltGrUsedByCurrentInputMethod() const OVERRIDE; | 91 virtual bool IsAltGrUsedByCurrentInputMethod() const override; |
92 virtual ImeKeyboard* GetImeKeyboard() OVERRIDE; | 92 virtual ImeKeyboard* GetImeKeyboard() override; |
93 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE; | 93 virtual InputMethodUtil* GetInputMethodUtil() override; |
94 virtual ComponentExtensionIMEManager* | 94 virtual ComponentExtensionIMEManager* |
95 GetComponentExtensionIMEManager() OVERRIDE; | 95 GetComponentExtensionIMEManager() override; |
96 virtual bool IsLoginKeyboard(const std::string& layout) const OVERRIDE; | 96 virtual bool IsLoginKeyboard(const std::string& layout) const override; |
97 virtual bool MigrateInputMethods( | 97 virtual bool MigrateInputMethods( |
98 std::vector<std::string>* input_method_ids) OVERRIDE; | 98 std::vector<std::string>* input_method_ids) override; |
99 virtual scoped_refptr<InputMethodManager::State> CreateNewState( | 99 virtual scoped_refptr<InputMethodManager::State> CreateNewState( |
100 Profile* profile) OVERRIDE; | 100 Profile* profile) override; |
101 virtual scoped_refptr<InputMethodManager::State> GetActiveIMEState() OVERRIDE; | 101 virtual scoped_refptr<InputMethodManager::State> GetActiveIMEState() override; |
102 virtual void SetState( | 102 virtual void SetState( |
103 scoped_refptr<InputMethodManager::State> state) OVERRIDE; | 103 scoped_refptr<InputMethodManager::State> state) override; |
104 | 104 |
105 // Sets an input method ID which will be returned by GetCurrentInputMethod(). | 105 // Sets an input method ID which will be returned by GetCurrentInputMethod(). |
106 void SetCurrentInputMethodId(const std::string& input_method_id); | 106 void SetCurrentInputMethodId(const std::string& input_method_id); |
107 | 107 |
108 void SetComponentExtensionIMEManager( | 108 void SetComponentExtensionIMEManager( |
109 scoped_ptr<ComponentExtensionIMEManager> comp_ime_manager); | 109 scoped_ptr<ComponentExtensionIMEManager> comp_ime_manager); |
110 | 110 |
111 // Set values that will be provided to the InputMethodUtil. | 111 // Set values that will be provided to the InputMethodUtil. |
112 void set_application_locale(const std::string& value); | 112 void set_application_locale(const std::string& value); |
113 | 113 |
(...skipping 14 matching lines...) Expand all Loading... |
128 bool mod3_used_; | 128 bool mod3_used_; |
129 scoped_ptr<ComponentExtensionIMEManager> comp_ime_manager_; | 129 scoped_ptr<ComponentExtensionIMEManager> comp_ime_manager_; |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager); | 131 DISALLOW_COPY_AND_ASSIGN(MockInputMethodManager); |
132 }; | 132 }; |
133 | 133 |
134 } // namespace input_method | 134 } // namespace input_method |
135 } // namespace chromeos | 135 } // namespace chromeos |
136 | 136 |
137 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ | 137 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_MOCK_INPUT_METHOD_MANAGER_H_ |
OLD | NEW |