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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager_impl.h

Issue 11415266: Extract a delegate interface from c/b/input_method to permit decoupling from c/b. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Class comment. Created 8 years 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 | Annotate | Revision Log
OLDNEW
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_INPUT_METHOD_MANAGER_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/chromeos/input_method/browser_state_monitor.h" 14 #include "chrome/browser/chromeos/input_method/browser_state_monitor.h"
15 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" 15 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h"
16 #include "chrome/browser/chromeos/input_method/ibus_controller.h" 16 #include "chrome/browser/chromeos/input_method/ibus_controller.h"
17 #include "chrome/browser/chromeos/input_method/input_method_manager.h" 17 #include "chrome/browser/chromeos/input_method/input_method_manager.h"
18 #include "chrome/browser/chromeos/input_method/input_method_util.h" 18 #include "chrome/browser/chromeos/input_method/input_method_util.h"
19 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h" 19 #include "chrome/browser/chromeos/input_method/input_method_whitelist.h"
20 #include "chrome/browser/chromeos/input_method/xkeyboard.h" 20 #include "chrome/browser/chromeos/input_method/xkeyboard.h"
21 21
22 namespace chromeos { 22 namespace chromeos {
23 class InputMethodEngineIBus; 23 class InputMethodEngineIBus;
24 namespace input_method { 24 namespace input_method {
25 class InputMethodDelegate;
25 26
26 // The implementation of InputMethodManager. 27 // The implementation of InputMethodManager.
27 class InputMethodManagerImpl : public InputMethodManager, 28 class InputMethodManagerImpl : public InputMethodManager,
28 public CandidateWindowController::Observer, 29 public CandidateWindowController::Observer,
29 public IBusController::Observer { 30 public IBusController::Observer {
30 public: 31 public:
32 explicit InputMethodManagerImpl(scoped_ptr<InputMethodDelegate> delegate);
31 virtual ~InputMethodManagerImpl(); 33 virtual ~InputMethodManagerImpl();
32 34
33 // InputMethodManager override: 35 // InputMethodManager override:
34 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE; 36 virtual void AddObserver(InputMethodManager::Observer* observer) OVERRIDE;
35 virtual void AddCandidateWindowObserver( 37 virtual void AddCandidateWindowObserver(
36 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; 38 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE;
37 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE; 39 virtual void RemoveObserver(InputMethodManager::Observer* observer) OVERRIDE;
38 virtual void RemoveCandidateWindowObserver( 40 virtual void RemoveCandidateWindowObserver(
39 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE; 41 InputMethodManager::CandidateWindowObserver* observer) OVERRIDE;
40 virtual void SetState(State new_state) OVERRIDE; 42 virtual void SetState(State new_state) OVERRIDE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE; 75 virtual InputMethodUtil* GetInputMethodUtil() OVERRIDE;
74 76
75 // Sets |ibus_controller_|. 77 // Sets |ibus_controller_|.
76 void SetIBusControllerForTesting(IBusController* ibus_controller); 78 void SetIBusControllerForTesting(IBusController* ibus_controller);
77 // Sets |candidate_window_controller_|. 79 // Sets |candidate_window_controller_|.
78 void SetCandidateWindowControllerForTesting( 80 void SetCandidateWindowControllerForTesting(
79 CandidateWindowController* candidate_window_controller); 81 CandidateWindowController* candidate_window_controller);
80 // Sets |xkeyboard_|. 82 // Sets |xkeyboard_|.
81 void SetXKeyboardForTesting(XKeyboard* xkeyboard); 83 void SetXKeyboardForTesting(XKeyboard* xkeyboard);
82 84
83 // Creates a new instance of this class. The caller has to delete the returned
84 // object. The caller also have to set a mock CandidateWindowController,
85 // IBusController, and XKeyboard. See the setters above.
86 static InputMethodManagerImpl* GetInstanceForTesting();
87
88 private: 85 private:
89 friend class InputMethodManager; 86 friend class InputMethodManager;
90 InputMethodManagerImpl();
91 87
92 // IBusController overrides: 88 // IBusController overrides:
93 virtual void PropertyChanged() OVERRIDE; 89 virtual void PropertyChanged() OVERRIDE;
94 virtual void OnConnected() OVERRIDE; 90 virtual void OnConnected() OVERRIDE;
95 virtual void OnDisconnected() OVERRIDE; 91 virtual void OnDisconnected() OVERRIDE;
96 92
97 93
98 // CandidateWindowController::Observer overrides: 94 // CandidateWindowController::Observer overrides:
99 virtual void CandidateWindowOpened() OVERRIDE; 95 virtual void CandidateWindowOpened() OVERRIDE;
100 virtual void CandidateWindowClosed() OVERRIDE; 96 virtual void CandidateWindowClosed() OVERRIDE;
(...skipping 27 matching lines...) Expand all
128 // If |current_input_method_id_| is not in |input_method_ids|, switch to 124 // If |current_input_method_id_| is not in |input_method_ids|, switch to
129 // input_method_ids[0]. If the ID is equal to input_method_ids[N], switch to 125 // input_method_ids[0]. If the ID is equal to input_method_ids[N], switch to
130 // input_method_ids[N+1]. 126 // input_method_ids[N+1].
131 void SwitchToNextInputMethodInternal( 127 void SwitchToNextInputMethodInternal(
132 const std::vector<std::string>& input_method_ids, 128 const std::vector<std::string>& input_method_ids,
133 const std::string& current_input_method_id); 129 const std::string& current_input_method_id);
134 130
135 void ChangeInputMethodInternal(const std::string& input_method_id, 131 void ChangeInputMethodInternal(const std::string& input_method_id,
136 bool show_message); 132 bool show_message);
137 133
134 scoped_ptr<InputMethodDelegate> delegate_;
135
138 // The current browser status. 136 // The current browser status.
139 State state_; 137 State state_;
140 138
141 // A list of objects that monitor the manager. 139 // A list of objects that monitor the manager.
142 ObserverList<InputMethodManager::Observer> observers_; 140 ObserverList<InputMethodManager::Observer> observers_;
143 ObserverList<CandidateWindowObserver> candidate_window_observers_; 141 ObserverList<CandidateWindowObserver> candidate_window_observers_;
144 142
145 // The input method which was/is selected. 143 // The input method which was/is selected.
146 InputMethodDescriptor previous_input_method_; 144 InputMethodDescriptor previous_input_method_;
147 InputMethodDescriptor current_input_method_; 145 InputMethodDescriptor current_input_method_;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // auto-repeat interval. 184 // auto-repeat interval.
187 scoped_ptr<XKeyboard> xkeyboard_; 185 scoped_ptr<XKeyboard> xkeyboard_;
188 186
189 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl); 187 DISALLOW_COPY_AND_ASSIGN(InputMethodManagerImpl);
190 }; 188 };
191 189
192 } // namespace input_method 190 } // namespace input_method
193 } // namespace chromeos 191 } // namespace chromeos
194 192
195 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_ 193 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698