diff options
Diffstat (limited to 'chrome/browser/chromeos/input_method')
9 files changed, 38 insertions, 94 deletions
diff --git a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc index 41e2710..1c558cd 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc +++ b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.cc @@ -74,7 +74,6 @@ void CandidateWindowControllerImpl::Hide() { // HideAuxiliaryText. Without calling HideAuxiliaryText the // auxiliary text area will remain. candidate_window_view_->HideLookupTable(); - candidate_window_view_->HideAuxiliaryText(); if (infolist_window_) infolist_window_->HideImmediately(); } @@ -106,18 +105,6 @@ void CandidateWindowControllerImpl::SetCursorBounds( mode_indicator_controller_->SetCursorBounds(cursor_bounds); } -void CandidateWindowControllerImpl::UpdateAuxiliaryText( - const std::string& utf8_text, - bool visible) { - // If it's not visible, hide the auxiliary text and return. - if (!visible) { - candidate_window_view_->HideAuxiliaryText(); - return; - } - candidate_window_view_->UpdateAuxiliaryText(utf8_text); - candidate_window_view_->ShowAuxiliaryText(); -} - void CandidateWindowControllerImpl::FocusStateChanged(bool is_focused) { mode_indicator_controller_->FocusStateChanged(is_focused); } diff --git a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.h b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.h index 5ffae3c..aa84e70 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_controller_impl.h +++ b/chrome/browser/chromeos/input_method/candidate_window_controller_impl.h @@ -76,8 +76,6 @@ class CandidateWindowControllerImpl // IBusPanelCandidateWindowHandlerInterface implementation. virtual void SetCursorBounds(const gfx::Rect& cursor_bounds, const gfx::Rect& composition_head) OVERRIDE; - virtual void UpdateAuxiliaryText(const std::string& utf8_text, - bool visible) OVERRIDE; virtual void UpdateLookupTable(const CandidateWindow& candidate_window, bool visible) OVERRIDE; virtual void UpdatePreeditText(const std::string& utf8_text, diff --git a/chrome/browser/chromeos/input_method/candidate_window_view.cc b/chrome/browser/chromeos/input_method/candidate_window_view.cc index 35a4c6f..bd97f6e 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_view.cc +++ b/chrome/browser/chromeos/input_method/candidate_window_view.cc @@ -625,40 +625,11 @@ void CandidateWindowView::UpdateParentArea() { void CandidateWindowView::HideLookupTable() { candidate_area_->Hide(); - UpdateParentArea(); -} - -void CandidateWindowView::HideAuxiliaryText() { header_area_->Hide(); footer_area_->Hide(); UpdateParentArea(); } -void CandidateWindowView::ShowAuxiliaryText() { - // If candidate_area is not shown, shows auxiliary text at header_area. - // We expect both header_area_ and footer_area_ contain same value. - if (!candidate_area_->IsShown()) { - header_area_->Show(); - footer_area_->Hide(); - } else { - // If candidate_area is shown, shows auxiliary text with orientation. - if (candidate_window_.orientation() == CandidateWindow::HORIZONTAL) { - header_area_->Show(); - footer_area_->Hide(); - } else { - footer_area_->Show(); - header_area_->Hide(); - } - } - UpdateParentArea(); -} - -void CandidateWindowView::UpdateAuxiliaryText(const std::string& utf8_text) { - header_area_->SetText(utf8_text); - footer_area_->SetText(utf8_text); - ShowAuxiliaryText(); -} - void CandidateWindowView::HidePreeditText() { preedit_area_->Hide(); UpdateParentArea(); @@ -677,6 +648,19 @@ void CandidateWindowView::ShowLookupTable() { if (!candidate_area_->IsShown()) should_show_upper_side_ = false; candidate_area_->Show(); + + // Show auxiliary text. + if (!candidate_window_.is_auxiliary_text_visible()) { + header_area_->Hide(); + footer_area_->Hide(); + } else if (candidate_window_.orientation() == CandidateWindow::HORIZONTAL) { + header_area_->Show(); + footer_area_->Hide(); + } else { + header_area_->Hide(); + footer_area_->Show(); + } + UpdateParentArea(); } @@ -781,6 +765,12 @@ void CandidateWindowView::UpdateCandidates( selected_candidate_index_in_page_ = -1; } } + + // Updates auxiliary text + if (candidate_window_.is_auxiliary_text_visible()) { + header_area_->SetText(candidate_window_.auxiliary_text()); + footer_area_->SetText(candidate_window_.auxiliary_text()); + } } void CandidateWindowView::MaybeInitializeCandidateViews( diff --git a/chrome/browser/chromeos/input_method/candidate_window_view.h b/chrome/browser/chromeos/input_method/candidate_window_view.h index e587e1d..dc69f75 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_view.h +++ b/chrome/browser/chromeos/input_method/candidate_window_view.h @@ -84,9 +84,6 @@ class CandidateWindowView : public views::View { // Shows the preedit text. void ShowPreeditText(); - // Updates the auxiliary text. - void UpdateAuxiliaryText(const std::string& utf8_text); - // Updates the preedit text. void UpdatePreeditText(const std::string& utf8_text); diff --git a/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc b/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc index 19b5a5a..dbd8915 100644 --- a/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc +++ b/chrome/browser/chromeos/input_method/candidate_window_view_unittest.cc @@ -124,6 +124,7 @@ TEST_F(CandidateWindowViewTest, SelectCandidateAtTest) { &candidate_window_large); candidate_window_large.set_cursor_position(candidate_window_large_size - 1); candidate_window_view.UpdateCandidates(candidate_window_large); + // Select the last candidate. candidate_window_view.SelectCandidateAt(candidate_window_large_size - 1); diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc index 8edbb57..9751fa2 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine.cc @@ -51,15 +51,6 @@ void UpdatePreedit(const IBusText& ibus_text, input_context->UpdatePreeditText(ibus_text, cursor_pos, is_visible); } -// Notifies CandidateWindowHandler that the auxilary text is changed. -// Auxilary text is usually footer text. -void UpdateAuxiliaryText(const std::string& text, bool is_visible) { - IBusPanelCandidateWindowHandlerInterface* candidate_window = - IBusBridge::Get()->GetCandidateWindowHandler(); - if (candidate_window) - candidate_window->UpdateAuxiliaryText(text, is_visible); -} - } // namespace InputMethodEngine::InputMethodEngine() @@ -67,7 +58,6 @@ InputMethodEngine::InputMethodEngine() active_(false), context_id_(0), next_context_id_(1), - aux_text_visible_(false), observer_(NULL), preedit_text_(new IBusText()), preedit_cursor_(0), @@ -258,6 +248,9 @@ void InputMethodEngine::SetCandidateWindowProperty( property.show_window_at_composition; dest_property.cursor_position = candidate_window_->GetProperty().cursor_position; + dest_property.auxiliary_text = property.auxiliary_text; + dest_property.is_auxiliary_text_visible = property.is_auxiliary_text_visible; + candidate_window_->SetProperty(dest_property); candidate_window_property_ = property; @@ -284,22 +277,6 @@ bool InputMethodEngine::SetCandidateWindowVisible(bool visible, return true; } -void InputMethodEngine::SetCandidateWindowAuxText(const char* text) { - aux_text_.assign(text); - if (active_) { - // Should not show auxiliary text if the whole window visibility is false. - UpdateAuxiliaryText(aux_text_, window_visible_ && aux_text_visible_); - } -} - -void InputMethodEngine::SetCandidateWindowAuxTextVisible(bool visible) { - aux_text_visible_ = visible; - if (active_) { - // Should not show auxiliary text if the whole window visibility is false. - UpdateAuxiliaryText(aux_text_, window_visible_ && aux_text_visible_); - } -} - bool InputMethodEngine::SetCandidates( int context_id, const std::vector<Candidate>& candidates, diff --git a/chrome/browser/chromeos/input_method/input_method_engine.h b/chrome/browser/chromeos/input_method/input_method_engine.h index b49d1de..7763095 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.h +++ b/chrome/browser/chromeos/input_method/input_method_engine.h @@ -61,8 +61,6 @@ class InputMethodEngine : public InputMethodEngineInterface { const CandidateWindowProperty& property) OVERRIDE; virtual bool SetCandidateWindowVisible(bool visible, std::string* error) OVERRIDE; - virtual void SetCandidateWindowAuxText(const char* text) OVERRIDE; - virtual void SetCandidateWindowAuxTextVisible(bool visible) OVERRIDE; virtual bool SetCandidates(int context_id, const std::vector<Candidate>& candidates, std::string* error) OVERRIDE; @@ -116,10 +114,6 @@ class InputMethodEngine : public InputMethodEngineInterface { // This IME ID in ibus. std::string ibus_id_; - // The current auxialy text and it's visiblity. - std::string aux_text_; - bool aux_text_visible_; - // Pointer to the object recieving events for this IME. InputMethodEngineInterface::Observer* observer_; diff --git a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc index d7c6b87..5eaf11c 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc @@ -617,9 +617,11 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineIBusBrowserTest, ASSERT_TRUE(content::ExecuteScript( host->host_contents(), set_candidate_window_properties_test_script)); - EXPECT_EQ(1, mock_candidate_window->update_auxiliary_text_call_count()); - EXPECT_TRUE( - mock_candidate_window->last_update_auxiliary_text_arg().is_visible); + EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); + + const input_method::CandidateWindow& table = + mock_candidate_window->last_update_lookup_table_arg().lookup_table; + EXPECT_TRUE(table.is_auxiliary_text_visible()); } { SCOPED_TRACE("setCandidateWindowProperties:auxText test"); @@ -636,14 +638,13 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineIBusBrowserTest, ASSERT_TRUE(content::ExecuteScript( host->host_contents(), set_candidate_window_properties_test_script)); - EXPECT_EQ(1, mock_candidate_window->update_auxiliary_text_call_count()); + EXPECT_EQ(1, mock_candidate_window->update_lookup_table_call_count()); // aux text visibility is kept as before. - EXPECT_TRUE( - mock_candidate_window->last_update_auxiliary_text_arg().is_visible); - - EXPECT_EQ("AUXILIARY_TEXT", - mock_candidate_window->last_update_auxiliary_text_arg().text); + const input_method::CandidateWindow& table = + mock_candidate_window->last_update_lookup_table_arg().lookup_table; + EXPECT_TRUE(table.is_auxiliary_text_visible()); + EXPECT_EQ("AUXILIARY_TEXT", table.auxiliary_text()); } { SCOPED_TRACE("setCandidates test"); diff --git a/chrome/browser/chromeos/input_method/input_method_engine_interface.h b/chrome/browser/chromeos/input_method/input_method_engine_interface.h index 4fba077..8be354b 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_interface.h +++ b/chrome/browser/chromeos/input_method/input_method_engine_interface.h @@ -111,6 +111,11 @@ class InputMethodEngineInterface : public IBusEngineHandlerInterface { bool is_cursor_visible; bool is_vertical; bool show_window_at_composition; + + // Auxiliary text is typically displayed in the footer of the candidate + // window. + std::string auxiliary_text; + bool is_auxiliary_text_visible; }; struct SegmentInfo { @@ -204,12 +209,6 @@ class InputMethodEngineInterface : public IBusEngineHandlerInterface { // Show or hide the candidate window. virtual bool SetCandidateWindowVisible(bool visible, std::string* error) = 0; - // Set the text that appears as a label in the candidate window. - virtual void SetCandidateWindowAuxText(const char* text) = 0; - - // Show or hide the extra text in the candidate window. - virtual void SetCandidateWindowAuxTextVisible(bool visible) = 0; - // Set the list of entries displayed in the candidate window. virtual bool SetCandidates(int context_id, const std::vector<Candidate>& candidates, |