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

Side by Side Diff: ui/base/ime/input_method_mac.mm

Issue 2434433006: MacViews: Implement InputMethodMac::CancelComposition. (Closed)
Patch Set: Address comments. Created 4 years, 1 month 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
« no previous file with comments | « ui/base/ime/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_mac.h" 5 #include "ui/base/ime/input_method_mac.h"
6 6
7 #import <Cocoa/Cocoa.h>
8
7 namespace ui { 9 namespace ui {
8 10
9 InputMethodMac::InputMethodMac(internal::InputMethodDelegate* delegate) { 11 InputMethodMac::InputMethodMac(internal::InputMethodDelegate* delegate) {
10 SetDelegate(delegate); 12 SetDelegate(delegate);
11 } 13 }
12 14
13 InputMethodMac::~InputMethodMac() { 15 InputMethodMac::~InputMethodMac() {
14 } 16 }
15 17
16 bool InputMethodMac::OnUntranslatedIMEMessage(const base::NativeEvent& event, 18 bool InputMethodMac::OnUntranslatedIMEMessage(const base::NativeEvent& event,
17 NativeEventResult* result) { 19 NativeEventResult* result) {
18 return false; 20 return false;
19 } 21 }
20 22
21 void InputMethodMac::DispatchKeyEvent(ui::KeyEvent* event) { 23 void InputMethodMac::DispatchKeyEvent(ui::KeyEvent* event) {
22 // This is used on Mac only to dispatch events post-IME. 24 // This is used on Mac only to dispatch events post-IME.
23 ignore_result(DispatchKeyEventPostIME(event)); 25 ignore_result(DispatchKeyEventPostIME(event));
24 } 26 }
25 27
26 void InputMethodMac::OnCaretBoundsChanged(const TextInputClient* client) { 28 void InputMethodMac::OnCaretBoundsChanged(const TextInputClient* client) {
27 } 29 }
28 30
29 void InputMethodMac::CancelComposition(const TextInputClient* client) { 31 void InputMethodMac::CancelComposition(const TextInputClient* client) {
32 if (!IsTextInputClientFocused(client))
33 return;
34
35 [[NSTextInputContext currentInputContext] discardMarkedText];
30 } 36 }
31 37
32 bool InputMethodMac::IsCandidatePopupOpen() const { 38 bool InputMethodMac::IsCandidatePopupOpen() const {
33 // There seems to be no way to tell if a candidate window is open. 39 // There seems to be no way to tell if a candidate window is open.
34 return false; 40 return false;
35 } 41 }
36 42
37 } // namespace ui 43 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698