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

Unified Diff: chrome/browser/chromeos/input_method/candidate_window.cc

Issue 8888038: chromeos: Don't fire candidate window open/close events for suggestion window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change comment Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/candidate_window_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/input_method/candidate_window.cc
diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc
index f8589d96cd2773303d7f8b689df46dd59ca32a27..2e63959b8c672b00970b4fdf4e76984c1ff7cfe0 100644
--- a/chrome/browser/chromeos/input_method/candidate_window.cc
+++ b/chrome/browser/chromeos/input_method/candidate_window.cc
@@ -886,23 +886,18 @@ void CandidateWindowView::Init() {
}
void CandidateWindowView::HideAll() {
- bool was_visible = IsCandidateWindowOpen();
parent_frame_->Hide();
- if (was_visible) {
- FOR_EACH_OBSERVER(Observer, observers_, OnCandidateWindowClosed());
- }
+ NotifyIfCandidateWindowOpenedOrClosed();
}
void CandidateWindowView::HideLookupTable() {
- bool was_visible = IsCandidateWindowOpen();
candidate_area_->Hide();
if (preedit_area_->IsShown())
ResizeAndMoveParentFrame();
else
parent_frame_->Hide();
- if (was_visible) {
- FOR_EACH_OBSERVER(Observer, observers_, OnCandidateWindowClosed());
- }
+
+ NotifyIfCandidateWindowOpenedOrClosed();
}
InformationTextArea* CandidateWindowView::GetAuxiliaryTextArea() {
@@ -943,13 +938,23 @@ void CandidateWindowView::UpdatePreeditText(const std::string& utf8_text) {
}
void CandidateWindowView::ShowLookupTable() {
- bool was_visible = IsCandidateWindowOpen();
candidate_area_->Show();
ResizeAndMoveParentFrame();
parent_frame_->Show();
- if (!was_visible) {
+
+ NotifyIfCandidateWindowOpenedOrClosed();
+}
+
+void CandidateWindowView::NotifyIfCandidateWindowOpenedOrClosed() {
+ static bool was_open = false;
Yusuke Sato 2011/12/09 07:38:35 I think this does not work if the view object is c
+
+ bool is_open = IsCandidateWindowOpen();
+ if (!was_open && is_open) {
FOR_EACH_OBSERVER(Observer, observers_, OnCandidateWindowOpened());
+ } else if (was_open && !is_open) {
+ FOR_EACH_OBSERVER(Observer, observers_, OnCandidateWindowClosed());
}
+ was_open = is_open;
}
bool CandidateWindowView::ShouldUpdateCandidateViews(
@@ -1188,7 +1193,8 @@ void CandidateWindowView::MaybeInitializeCandidateViews(
}
bool CandidateWindowView::IsCandidateWindowOpen() const {
- return candidate_area_->IsVisible() && candidate_area_->IsShown();
+ return !is_suggestion_window_location_available_ &&
+ candidate_area_->IsVisible() && candidate_area_->IsShown();
}
void CandidateWindowView::SelectCandidateAt(int index_in_page) {
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/candidate_window_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698