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_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chromeos/dbus/ibus/ibus_lookup_table.h" | 10 #include "chromeos/dbus/ibus/ibus_lookup_table.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void UpdateAuxiliaryText(const std::string& utf8_text); | 90 void UpdateAuxiliaryText(const std::string& utf8_text); |
91 | 91 |
92 // Updates the preedit text. | 92 // Updates the preedit text. |
93 void UpdatePreeditText(const std::string& utf8_text); | 93 void UpdatePreeditText(const std::string& utf8_text); |
94 | 94 |
95 // Returns true if we should update candidate views in the window. For | 95 // Returns true if we should update candidate views in the window. For |
96 // instance, if we are going to show the same candidates as before, we | 96 // instance, if we are going to show the same candidates as before, we |
97 // don't have to update candidate views. This happens when the user just | 97 // don't have to update candidate views. This happens when the user just |
98 // moves the cursor in the same page in the candidate window. | 98 // moves the cursor in the same page in the candidate window. |
99 static bool ShouldUpdateCandidateViews( | 99 static bool ShouldUpdateCandidateViews( |
100 const ibus::IBusLookupTable& old_table, | 100 const IBusLookupTable& old_table, |
101 const ibus::IBusLookupTable& new_table); | 101 const IBusLookupTable& new_table); |
102 | 102 |
103 // Updates candidates of the candidate window from |lookup_table|. | 103 // Updates candidates of the candidate window from |lookup_table|. |
104 // Candidates are arranged per |orientation|. | 104 // Candidates are arranged per |orientation|. |
105 void UpdateCandidates(const ibus::IBusLookupTable& lookup_table); | 105 void UpdateCandidates(const IBusLookupTable& lookup_table); |
106 | 106 |
107 // Resizes and moves the parent frame. The two actions should be | 107 // Resizes and moves the parent frame. The two actions should be |
108 // performed consecutively as resizing may require the candidate window | 108 // performed consecutively as resizing may require the candidate window |
109 // to move. For instance, we may need to move the candidate window from | 109 // to move. For instance, we may need to move the candidate window from |
110 // below the cursor to above the cursor, if the candidate window becomes | 110 // below the cursor to above the cursor, if the candidate window becomes |
111 // too big to be shown near the bottom of the screen. This function | 111 // too big to be shown near the bottom of the screen. This function |
112 // needs to be called when the visible contents of the candidate window | 112 // needs to be called when the visible contents of the candidate window |
113 // are modified. | 113 // are modified. |
114 void ResizeAndMoveParentFrame(); | 114 void ResizeAndMoveParentFrame(); |
115 | 115 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // Override View::OnBoundsChanged() | 147 // Override View::OnBoundsChanged() |
148 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 148 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; |
149 | 149 |
150 private: | 150 private: |
151 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, MozcUpdateCandidateTest); | 151 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, MozcUpdateCandidateTest); |
152 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, ShortcutSettingTest); | 152 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, ShortcutSettingTest); |
153 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, | 153 FRIEND_TEST_ALL_PREFIXES(CandidateWindowViewTest, |
154 DoNotChangeRowHeightWithLabelSwitchTest); | 154 DoNotChangeRowHeightWithLabelSwitchTest); |
155 | 155 |
156 // Initializes the candidate views if needed. | 156 // Initializes the candidate views if needed. |
157 void MaybeInitializeCandidateViews(const ibus::IBusLookupTable& lookup_table); | 157 void MaybeInitializeCandidateViews(const IBusLookupTable& lookup_table); |
158 | 158 |
159 // Returns the appropriate area (header or footer) to put auxiliary texts. | 159 // Returns the appropriate area (header or footer) to put auxiliary texts. |
160 InformationTextArea* GetAuxiliaryTextArea(); | 160 InformationTextArea* GetAuxiliaryTextArea(); |
161 | 161 |
162 // Returns true if the candidate window is open. The suggestion window does | 162 // Returns true if the candidate window is open. The suggestion window does |
163 // not count as the candidate window. | 163 // not count as the candidate window. |
164 bool IsCandidateWindowOpen() const; | 164 bool IsCandidateWindowOpen() const; |
165 | 165 |
166 // Notifies observers if the candidate window's opened/closed state has | 166 // Notifies observers if the candidate window's opened/closed state has |
167 // changed from the previous call to this function. | 167 // changed from the previous call to this function. |
168 void NotifyIfCandidateWindowOpenedOrClosed(); | 168 void NotifyIfCandidateWindowOpenedOrClosed(); |
169 | 169 |
170 // The lookup table (candidates). | 170 // The lookup table (candidates). |
171 ibus::IBusLookupTable lookup_table_; | 171 IBusLookupTable lookup_table_; |
172 | 172 |
173 // The index in the current page of the candidate currently being selected. | 173 // The index in the current page of the candidate currently being selected. |
174 int selected_candidate_index_in_page_; | 174 int selected_candidate_index_in_page_; |
175 | 175 |
176 // The observers of the object. | 176 // The observers of the object. |
177 ObserverList<Observer> observers_; | 177 ObserverList<Observer> observers_; |
178 | 178 |
179 // The parent frame. | 179 // The parent frame. |
180 views::Widget* parent_frame_; | 180 views::Widget* parent_frame_; |
181 | 181 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // if should be, shows parent_frame and if not, hides parent_frame. | 226 // if should be, shows parent_frame and if not, hides parent_frame. |
227 void UpdateParentArea(); | 227 void UpdateParentArea(); |
228 | 228 |
229 DISALLOW_COPY_AND_ASSIGN(CandidateWindowView); | 229 DISALLOW_COPY_AND_ASSIGN(CandidateWindowView); |
230 }; | 230 }; |
231 | 231 |
232 } // namespace input_method | 232 } // namespace input_method |
233 } // namespace chromeos | 233 } // namespace chromeos |
234 | 234 |
235 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ | 235 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_CANDIDATE_WINDOW_VIEW_H_ |
OLD | NEW |