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

Side by Side Diff: ui/base/ime/input_method_tsf.cc

Issue 80583002: [FYI] All-in-one OnCandidateWindow{Show,Update,Hide} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "ui/base/ime/input_method_tsf.h" 5 #include "ui/base/ime/input_method_tsf.h"
6 6
7 #include "ui/base/ime/text_input_client.h" 7 #include "ui/base/ime/text_input_client.h"
8 #include "ui/base/ime/win/tsf_bridge.h" 8 #include "ui/base/ime/win/tsf_bridge.h"
9 #include "ui/base/ime/win/tsf_event_router.h" 9 #include "ui/base/ime/win/tsf_event_router.h"
10 10
11 namespace ui { 11 namespace ui {
12 12
13 class InputMethodTSF::TSFEventObserver : public TSFEventRouterObserver { 13 class InputMethodTSF::TSFEventObserver : public TSFEventRouterObserver {
14 public: 14 public:
15 TSFEventObserver() : is_candidate_popup_open_(false) {} 15 TSFEventObserver() : is_candidate_popup_open_(false), window_count_(0) {}
16 16
17 // Returns true if we know for sure that a candidate window (or IME suggest, 17 // Returns true if we know for sure that a candidate window (or IME suggest,
18 // etc.) is open. 18 // etc.) is open.
19 bool IsCandidatePopupOpen() const { return is_candidate_popup_open_; } 19 bool IsCandidatePopupOpen() const { return is_candidate_popup_open_; }
20 20
21 // Overridden from TSFEventRouterObserver: 21 // Overridden from TSFEventRouterObserver:
22 virtual void OnCandidateWindowCountChanged(size_t window_count) OVERRIDE { 22 virtual void OnCandidateWindowCountChanged(size_t window_count) OVERRIDE {
23 is_candidate_popup_open_ = (window_count != 0); 23 is_candidate_popup_open_ = (window_count != 0);
24 if (window_count_ == 0 && window_count) {
25 ui::TSFBridge::GetInstance()->OnCandidateWindowShow();
yukawa 2013/11/25 05:07:42 I'm not sure if we can safely call back external c
26 } else if (window_count_ && window_count) {
27 ui::TSFBridge::GetInstance()->OnCandidateWindowUpdate();
28 } else if (window_count_ && window_count == 0) {
29 ui::TSFBridge::GetInstance()->OnCandidateWindowHide();
30 }
31 window_count_ = window_count;
24 } 32 }
25 33
26 private: 34 private:
27 // True if we know for sure that a candidate window is open. 35 // True if we know for sure that a candidate window is open.
28 bool is_candidate_popup_open_; 36 bool is_candidate_popup_open_;
37 int window_count_;
29 38
30 DISALLOW_COPY_AND_ASSIGN(TSFEventObserver); 39 DISALLOW_COPY_AND_ASSIGN(TSFEventObserver);
31 }; 40 };
32 41
33 InputMethodTSF::InputMethodTSF(internal::InputMethodDelegate* delegate, 42 InputMethodTSF::InputMethodTSF(internal::InputMethodDelegate* delegate,
34 HWND toplevel_window_handle) 43 HWND toplevel_window_handle)
35 : InputMethodWin(delegate, toplevel_window_handle), 44 : InputMethodWin(delegate, toplevel_window_handle),
36 tsf_event_observer_(new TSFEventObserver()), 45 tsf_event_observer_(new TSFEventObserver()),
37 tsf_event_router_(new TSFEventRouter(tsf_event_observer_.get())) { 46 tsf_event_router_(new TSFEventRouter(tsf_event_observer_.get())) {
38 // In non-Aura environment, appropriate callbacks to OnFocus() and OnBlur() 47 // In non-Aura environment, appropriate callbacks to OnFocus() and OnBlur()
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 159 }
151 InputMethodWin::OnDidChangeFocusedClient(focused_before, focused); 160 InputMethodWin::OnDidChangeFocusedClient(focused_before, focused);
152 } 161 }
153 162
154 void InputMethodTSF::ConfirmCompositionText() { 163 void InputMethodTSF::ConfirmCompositionText() {
155 if (!IsTextInputTypeNone()) 164 if (!IsTextInputTypeNone())
156 ui::TSFBridge::GetInstance()->ConfirmComposition(); 165 ui::TSFBridge::GetInstance()->ConfirmComposition();
157 } 166 }
158 167
159 } // namespace ui 168 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698