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_CANDIDATE_WINDOW_CONTROLLER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" | 8 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "chrome/browser/chromeos/input_method/candidate_window_view.h" | 12 #include "chrome/browser/chromeos/input_method/candidate_window_view.h" |
13 #include "chrome/browser/chromeos/input_method/ibus_controller.h" | 13 #include "chrome/browser/chromeos/input_method/ibus_controller.h" |
14 #include "chrome/browser/chromeos/input_method/infolist_window_view.h" | 14 #include "chrome/browser/chromeos/input_method/infolist_window_view.h" |
| 15 #include "chromeos/dbus/ibus/ibus_panel_service.h" |
15 | 16 |
16 namespace views { | 17 namespace views { |
17 class Widget; | 18 class Widget; |
18 } // namespace views | 19 } // namespace views |
19 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
21 // TODO(nona): remove ibus namespace | 22 // TODO(nona): remove ibus namespace |
22 namespace ibus { | 23 namespace ibus { |
23 class IBusLookupTable; | 24 class IBusLookupTable; |
24 } // namespace ibus | 25 } // namespace ibus |
25 namespace input_method { | 26 namespace input_method { |
26 | 27 |
27 class DelayableWidget; | 28 class DelayableWidget; |
28 | 29 |
29 // The implementation of CandidateWindowController. | 30 // The implementation of CandidateWindowController. |
30 // CandidateWindowController controls the CandidateWindow. | 31 // CandidateWindowController controls the CandidateWindow. |
31 class CandidateWindowControllerImpl : public CandidateWindowController, | 32 class CandidateWindowControllerImpl |
32 public CandidateWindowView::Observer, | 33 : public CandidateWindowController, |
33 public IBusUiController::Observer, | 34 public CandidateWindowView::Observer, |
34 public IBusController::Observer { | 35 public ibus::IBusPanelCandidateWindowHandlerInterface, |
| 36 public IBusController::Observer { |
35 public: | 37 public: |
36 CandidateWindowControllerImpl(); | 38 CandidateWindowControllerImpl(); |
37 virtual ~CandidateWindowControllerImpl(); | 39 virtual ~CandidateWindowControllerImpl(); |
38 | 40 |
39 // CandidateWindowController overrides: | 41 // CandidateWindowController overrides: |
40 virtual bool Init(IBusController* controller) OVERRIDE; | 42 virtual bool Init(IBusController* controller) OVERRIDE; |
41 virtual void Shutdown(IBusController* controller) OVERRIDE; | 43 virtual void Shutdown(IBusController* controller) OVERRIDE; |
42 virtual void AddObserver( | 44 virtual void AddObserver( |
43 CandidateWindowController::Observer* observer) OVERRIDE; | 45 CandidateWindowController::Observer* observer) OVERRIDE; |
44 virtual void RemoveObserver( | 46 virtual void RemoveObserver( |
(...skipping 29 matching lines...) Expand all Loading... |
74 | 76 |
75 private: | 77 private: |
76 // CandidateWindowView::Observer implementation. | 78 // CandidateWindowView::Observer implementation. |
77 virtual void OnCandidateCommitted(int index, int button, int flags) OVERRIDE; | 79 virtual void OnCandidateCommitted(int index, int button, int flags) OVERRIDE; |
78 virtual void OnCandidateWindowOpened() OVERRIDE; | 80 virtual void OnCandidateWindowOpened() OVERRIDE; |
79 virtual void OnCandidateWindowClosed() OVERRIDE; | 81 virtual void OnCandidateWindowClosed() OVERRIDE; |
80 | 82 |
81 // Creates the candidate window view. | 83 // Creates the candidate window view. |
82 void CreateView(); | 84 void CreateView(); |
83 | 85 |
84 // IBusUiController::Observer overrides. | 86 // ibus::IBusPanelCandidateWindowHandlerInterface overrides. |
85 virtual void OnHideAuxiliaryText() OVERRIDE; | 87 virtual void HideAuxiliaryText() OVERRIDE; |
86 virtual void OnHideLookupTable() OVERRIDE; | 88 virtual void HideLookupTable() OVERRIDE; |
87 virtual void OnHidePreeditText() OVERRIDE; | 89 virtual void HidePreeditText() OVERRIDE; |
88 virtual void OnSetCursorLocation(const ibus::Rect& cursor_position, | 90 virtual void SetCursorLocation(const ibus::Rect& cursor_position, |
89 const ibus::Rect& composition_head) OVERRIDE; | 91 const ibus::Rect& composition_head) OVERRIDE; |
90 virtual void OnUpdateAuxiliaryText(const std::string& utf8_text, | 92 virtual void UpdateAuxiliaryText(const std::string& utf8_text, |
91 bool visible) OVERRIDE; | 93 bool visible) OVERRIDE; |
92 virtual void OnUpdateLookupTable( | 94 virtual void UpdateLookupTable(const ibus::IBusLookupTable& lookup_table, |
93 const ibus::IBusLookupTable& lookup_table, | 95 bool visible) OVERRIDE; |
94 bool visible) OVERRIDE; | 96 virtual void UpdatePreeditText(const std::string& utf8_text, |
95 virtual void OnUpdatePreeditText(const std::string& utf8_text, | 97 unsigned int cursor, bool visible) OVERRIDE; |
96 unsigned int cursor, bool visible) OVERRIDE; | |
97 | 98 |
98 // IBusController::Observer override | 99 // IBusController::Observer override |
99 virtual void PropertyChanged() OVERRIDE; | 100 virtual void PropertyChanged() OVERRIDE; |
100 virtual void OnConnected() OVERRIDE; | 101 virtual void OnConnected() OVERRIDE; |
101 virtual void OnDisconnected() OVERRIDE; | 102 virtual void OnDisconnected() OVERRIDE; |
102 | 103 |
103 // Updates infolist bounds, if current bounds is up-to-date, this function | 104 // Updates infolist bounds, if current bounds is up-to-date, this function |
104 // does nothing. | 105 // does nothing. |
105 void UpdateInfolistBounds(); | 106 void UpdateInfolistBounds(); |
106 | 107 |
107 // The controller is used for communicating with the IBus daemon. | |
108 scoped_ptr<IBusUiController> ibus_ui_controller_; | |
109 | |
110 // The candidate window view. | 108 // The candidate window view. |
111 CandidateWindowView* candidate_window_; | 109 CandidateWindowView* candidate_window_; |
112 | 110 |
113 // This is the outer frame of the candidate window view. The frame will | 111 // This is the outer frame of the candidate window view. The frame will |
114 // own |candidate_window_|. | 112 // own |candidate_window_|. |
115 scoped_ptr<views::Widget> frame_; | 113 scoped_ptr<views::Widget> frame_; |
116 | 114 |
117 // This is the outer frame of the infolist window view. The frame will | 115 // This is the outer frame of the infolist window view. The frame will |
118 // own |infolist_window_|. | 116 // own |infolist_window_|. |
119 scoped_ptr<DelayableWidget> infolist_window_; | 117 scoped_ptr<DelayableWidget> infolist_window_; |
120 | 118 |
121 // The infolist entries and its focused index which currently shown in | 119 // The infolist entries and its focused index which currently shown in |
122 // Infolist window. | 120 // Infolist window. |
123 std::vector<InfolistWindowView::Entry> latest_infolist_entries_; | 121 std::vector<InfolistWindowView::Entry> latest_infolist_entries_; |
124 size_t latest_infolist_focused_index_; | 122 size_t latest_infolist_focused_index_; |
125 | 123 |
126 ObserverList<CandidateWindowController::Observer> observers_; | 124 ObserverList<CandidateWindowController::Observer> observers_; |
127 | 125 |
128 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); | 126 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); |
129 }; | 127 }; |
130 | 128 |
131 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL
_H_ | 129 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL
_H_ |
132 | 130 |
133 } // namespace input_method | 131 } // namespace input_method |
134 } // namespace chromeos | 132 } // namespace chromeos |
OLD | NEW |