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/views/ime/input_method_bridge.h" | 5 #include "ui/views/ime/input_method_bridge.h" |
6 | 6 |
7 #include "ui/base/ime/input_method.h" | 7 #include "ui/base/ime/input_method.h" |
8 #include "ui/base/ime/input_method_observer.h" | 8 #include "ui/base/ime/input_method_observer.h" |
9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 client->ExtendSelectionAndDelete(before, after); | 302 client->ExtendSelectionAndDelete(before, after); |
303 } | 303 } |
304 | 304 |
305 void InputMethodBridge::EnsureCaretInRect(const gfx::Rect& rect) { | 305 void InputMethodBridge::EnsureCaretInRect(const gfx::Rect& rect) { |
306 TextInputClient* client = GetTextInputClient(); | 306 TextInputClient* client = GetTextInputClient(); |
307 if (client) | 307 if (client) |
308 client->EnsureCaretInRect(rect); | 308 client->EnsureCaretInRect(rect); |
309 } | 309 } |
310 | 310 |
311 void InputMethodBridge::OnCandidateWindowShown() { | 311 void InputMethodBridge::OnCandidateWindowShown() { |
| 312 TextInputClient* client = GetTextInputClient(); |
| 313 if (client) |
| 314 client->OnCandidateWindowShown(); |
312 } | 315 } |
313 | 316 |
314 void InputMethodBridge::OnCandidateWindowUpdated() { | 317 void InputMethodBridge::OnCandidateWindowUpdated() { |
| 318 TextInputClient* client = GetTextInputClient(); |
| 319 if (client) |
| 320 client->OnCandidateWindowUpdated(); |
315 } | 321 } |
316 | 322 |
317 void InputMethodBridge::OnCandidateWindowHidden() { | 323 void InputMethodBridge::OnCandidateWindowHidden() { |
| 324 TextInputClient* client = GetTextInputClient(); |
| 325 if (client) |
| 326 client->OnCandidateWindowHidden(); |
318 } | 327 } |
319 | 328 |
320 // Overridden from FocusChangeListener. | 329 // Overridden from FocusChangeListener. |
321 void InputMethodBridge::OnWillChangeFocus(View* focused_before, View* focused) { | 330 void InputMethodBridge::OnWillChangeFocus(View* focused_before, View* focused) { |
322 if (HasCompositionText()) { | 331 if (HasCompositionText()) { |
323 ConfirmCompositionText(); | 332 ConfirmCompositionText(); |
324 CancelComposition(focused_before); | 333 CancelComposition(focused_before); |
325 } | 334 } |
326 } | 335 } |
327 | 336 |
328 void InputMethodBridge::OnDidChangeFocus(View* focused_before, View* focused) { | 337 void InputMethodBridge::OnDidChangeFocus(View* focused_before, View* focused) { |
329 DCHECK_EQ(GetFocusedView(), focused); | 338 DCHECK_EQ(GetFocusedView(), focused); |
330 OnTextInputTypeChanged(focused); | 339 OnTextInputTypeChanged(focused); |
331 OnCaretBoundsChanged(focused); | 340 OnCaretBoundsChanged(focused); |
332 } | 341 } |
333 | 342 |
334 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { | 343 ui::InputMethod* InputMethodBridge::GetHostInputMethod() const { |
335 return host_; | 344 return host_; |
336 } | 345 } |
337 | 346 |
338 | 347 |
339 } // namespace views | 348 } // namespace views |
OLD | NEW |