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 | 15 |
16 namespace views { | 16 namespace views { |
17 class Widget; | 17 class Widget; |
18 } // namespace views | 18 } // namespace views |
19 | 19 |
20 namespace chromeos { | 20 namespace chromeos { |
| 21 // TODO(nona): remove ibus namespace |
| 22 namespace ibus { |
| 23 class IBusLookupTable; |
| 24 } // namespace ibus |
21 namespace input_method { | 25 namespace input_method { |
22 | 26 |
23 class DelayableWidget; | 27 class DelayableWidget; |
24 | 28 |
25 // The implementation of CandidateWindowController. | 29 // The implementation of CandidateWindowController. |
26 // CandidateWindowController controls the CandidateWindow. | 30 // CandidateWindowController controls the CandidateWindow. |
27 class CandidateWindowControllerImpl : public CandidateWindowController, | 31 class CandidateWindowControllerImpl : public CandidateWindowController, |
28 public CandidateWindowView::Observer, | 32 public CandidateWindowView::Observer, |
29 public IBusUiController::Observer, | 33 public IBusUiController::Observer, |
30 public IBusController::Observer { | 34 public IBusController::Observer { |
(...skipping 18 matching lines...) Expand all Loading... |
49 // screen, infolist window is shown with clipping to bottom of screen. | 53 // screen, infolist window is shown with clipping to bottom of screen. |
50 // Infolist window does not overflow top and left direction. | 54 // Infolist window does not overflow top and left direction. |
51 static gfx::Point GetInfolistWindowPosition( | 55 static gfx::Point GetInfolistWindowPosition( |
52 const gfx::Rect& candidate_window_rect, | 56 const gfx::Rect& candidate_window_rect, |
53 const gfx::Rect& screen_rect, | 57 const gfx::Rect& screen_rect, |
54 const gfx::Size& infolist_winodw_size); | 58 const gfx::Size& infolist_winodw_size); |
55 | 59 |
56 // Converts |lookup_table| to infolist entries. |focused_index| become | 60 // Converts |lookup_table| to infolist entries. |focused_index| become |
57 // InfolistWindowView::InvalidFocusIndex if there is no selected entries. | 61 // InfolistWindowView::InvalidFocusIndex if there is no selected entries. |
58 static void ConvertLookupTableToInfolistEntry( | 62 static void ConvertLookupTableToInfolistEntry( |
59 const InputMethodLookupTable& lookup_table, | 63 const ibus::IBusLookupTable& lookup_table, |
60 std::vector<InfolistWindowView::Entry>* infolist_entries, | 64 std::vector<InfolistWindowView::Entry>* infolist_entries, |
61 size_t* focused_index); | 65 size_t* focused_index); |
62 | 66 |
63 // Returns true if given |new_entries| is different from |old_entries| and | 67 // Returns true if given |new_entries| is different from |old_entries| and |
64 // should update current window. | 68 // should update current window. |
65 static bool ShouldUpdateInfolist( | 69 static bool ShouldUpdateInfolist( |
66 const std::vector<InfolistWindowView::Entry>& old_entries, | 70 const std::vector<InfolistWindowView::Entry>& old_entries, |
67 size_t old_focused_index, | 71 size_t old_focused_index, |
68 const std::vector<InfolistWindowView::Entry>& new_entries, | 72 const std::vector<InfolistWindowView::Entry>& new_entries, |
69 size_t new_focused_index); | 73 size_t new_focused_index); |
70 | 74 |
71 private: | 75 private: |
72 // CandidateWindowView::Observer implementation. | 76 // CandidateWindowView::Observer implementation. |
73 virtual void OnCandidateCommitted(int index, int button, int flags) OVERRIDE; | 77 virtual void OnCandidateCommitted(int index, int button, int flags) OVERRIDE; |
74 virtual void OnCandidateWindowOpened() OVERRIDE; | 78 virtual void OnCandidateWindowOpened() OVERRIDE; |
75 virtual void OnCandidateWindowClosed() OVERRIDE; | 79 virtual void OnCandidateWindowClosed() OVERRIDE; |
76 | 80 |
77 // Creates the candidate window view. | 81 // Creates the candidate window view. |
78 void CreateView(); | 82 void CreateView(); |
79 | 83 |
80 // IBusUiController::Observer overrides. | 84 // IBusUiController::Observer overrides. |
81 virtual void OnHideAuxiliaryText() OVERRIDE; | 85 virtual void OnHideAuxiliaryText() OVERRIDE; |
82 virtual void OnHideLookupTable() OVERRIDE; | 86 virtual void OnHideLookupTable() OVERRIDE; |
83 virtual void OnHidePreeditText() OVERRIDE; | 87 virtual void OnHidePreeditText() OVERRIDE; |
84 virtual void OnSetCursorLocation(const gfx::Rect& cursor_position, | 88 virtual void OnSetCursorLocation(const gfx::Rect& cursor_position, |
85 const gfx::Rect& composition_head) OVERRIDE; | 89 const gfx::Rect& composition_head) OVERRIDE; |
86 virtual void OnUpdateAuxiliaryText(const std::string& utf8_text, | 90 virtual void OnUpdateAuxiliaryText(const std::string& utf8_text, |
87 bool visible) OVERRIDE; | 91 bool visible) OVERRIDE; |
88 virtual void OnUpdateLookupTable( | 92 virtual void OnUpdateLookupTable( |
89 const InputMethodLookupTable& lookup_table) OVERRIDE; | 93 const ibus::IBusLookupTable& lookup_table, |
| 94 bool visible) OVERRIDE; |
90 virtual void OnUpdatePreeditText(const std::string& utf8_text, | 95 virtual void OnUpdatePreeditText(const std::string& utf8_text, |
91 unsigned int cursor, bool visible) OVERRIDE; | 96 unsigned int cursor, bool visible) OVERRIDE; |
92 | 97 |
93 // IBusController::Observer override | 98 // IBusController::Observer override |
94 virtual void PropertyChanged() OVERRIDE; | 99 virtual void PropertyChanged() OVERRIDE; |
95 virtual void OnConnected() OVERRIDE; | 100 virtual void OnConnected() OVERRIDE; |
96 virtual void OnDisconnected() OVERRIDE; | 101 virtual void OnDisconnected() OVERRIDE; |
97 | 102 |
98 // Updates infolist bounds, if current bounds is up-to-date, this function | 103 // Updates infolist bounds, if current bounds is up-to-date, this function |
99 // does nothing. | 104 // does nothing. |
(...skipping 20 matching lines...) Expand all Loading... |
120 | 125 |
121 ObserverList<CandidateWindowController::Observer> observers_; | 126 ObserverList<CandidateWindowController::Observer> observers_; |
122 | 127 |
123 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); | 128 DISALLOW_COPY_AND_ASSIGN(CandidateWindowControllerImpl); |
124 }; | 129 }; |
125 | 130 |
126 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL
_H_ | 131 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_CONTROLLER_IMPL
_H_ |
127 | 132 |
128 } // namespace input_method | 133 } // namespace input_method |
129 } // namespace chromeos | 134 } // namespace chromeos |
OLD | NEW |