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 #include "ui/base/ime/input_method_base.h" | 5 #include "ui/base/ime/input_method_base.h" |
6 | 6 |
| 7 #include "base/bind.h" |
7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" |
8 #include "ui/base/ime/input_method_delegate.h" | 10 #include "ui/base/ime/input_method_delegate.h" |
9 #include "ui/base/ime/input_method_observer.h" | 11 #include "ui/base/ime/input_method_observer.h" |
10 #include "ui/base/ime/text_input_client.h" | 12 #include "ui/base/ime/text_input_client.h" |
11 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
12 | 14 |
13 namespace ui { | 15 namespace ui { |
14 | 16 |
15 InputMethodBase::InputMethodBase() | 17 InputMethodBase::InputMethodBase() |
16 : delegate_(NULL), | 18 : delegate_(NULL), |
17 text_input_client_(NULL), | 19 text_input_client_(NULL), |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 TextInputClient* client) { | 125 TextInputClient* client) { |
124 TextInputClient* old = text_input_client_; | 126 TextInputClient* old = text_input_client_; |
125 if (old == client) | 127 if (old == client) |
126 return; | 128 return; |
127 OnWillChangeFocusedClient(old, client); | 129 OnWillChangeFocusedClient(old, client); |
128 text_input_client_ = client; // NULL allowed. | 130 text_input_client_ = client; // NULL allowed. |
129 OnDidChangeFocusedClient(old, client); | 131 OnDidChangeFocusedClient(old, client); |
130 NotifyTextInputStateChanged(text_input_client_); | 132 NotifyTextInputStateChanged(text_input_client_); |
131 } | 133 } |
132 | 134 |
| 135 void InputMethodBase::OnCandidateWindowShown() { |
| 136 base::MessageLoop::current()->PostTask( |
| 137 FROM_HERE, |
| 138 base::Bind(&InputMethodBase::CandidateWindowShownCallback, AsWeakPtr())); |
| 139 } |
| 140 |
| 141 void InputMethodBase::OnCandidateWindowUpdated() { |
| 142 base::MessageLoop::current()->PostTask( |
| 143 FROM_HERE, |
| 144 base::Bind(&InputMethodBase::CandidateWindowUpdatedCallback, |
| 145 AsWeakPtr())); |
| 146 } |
| 147 |
| 148 void InputMethodBase::OnCandidateWindowHidden() { |
| 149 base::MessageLoop::current()->PostTask( |
| 150 FROM_HERE, |
| 151 base::Bind(&InputMethodBase::CandidateWindowHiddenCallback, AsWeakPtr())); |
| 152 } |
| 153 |
| 154 void InputMethodBase::CandidateWindowShownCallback() { |
| 155 if (text_input_client_) |
| 156 text_input_client_->OnCandidateWindowShown(); |
| 157 } |
| 158 |
| 159 void InputMethodBase::CandidateWindowUpdatedCallback() { |
| 160 if (text_input_client_) |
| 161 text_input_client_->OnCandidateWindowUpdated(); |
| 162 } |
| 163 |
| 164 void InputMethodBase::CandidateWindowHiddenCallback() { |
| 165 if (text_input_client_) |
| 166 text_input_client_->OnCandidateWindowHidden(); |
| 167 } |
| 168 |
133 } // namespace ui | 169 } // namespace ui |
OLD | NEW |