| OLD | NEW |
| 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) { |
| 20 NOTREACHED(); // Only called on Windows. |
| 18 return false; | 21 return false; |
| 19 } | 22 } |
| 20 | 23 |
| 21 bool InputMethodMac::DispatchKeyEvent(const ui::KeyEvent& event) { | 24 bool InputMethodMac::DispatchKeyEvent(const ui::KeyEvent& event) { |
| 22 // This is used on Mac only to dispatch events post-IME. | 25 // This is used on Mac only to dispatch events post-IME. |
| 23 return DispatchKeyEventPostIME(event); | 26 return DispatchKeyEventPostIME(event); |
| 24 } | 27 } |
| 25 | 28 |
| 26 void InputMethodMac::OnCaretBoundsChanged(const TextInputClient* client) { | 29 void InputMethodMac::OnCaretBoundsChanged(const TextInputClient* client) { |
| 30 // Call invalidateCharacterCoordinates? |
| 27 } | 31 } |
| 28 | 32 |
| 29 void InputMethodMac::CancelComposition(const TextInputClient* client) { | 33 void InputMethodMac::CancelComposition(const TextInputClient* client) { |
| 34 [[NSTextInputContext currentInputContext] discardMarkedText]; |
| 30 } | 35 } |
| 31 | 36 |
| 32 void InputMethodMac::OnInputLocaleChanged() { | 37 void InputMethodMac::OnInputLocaleChanged() { |
| 38 NOTREACHED(); // Only called on Windows. |
| 33 } | 39 } |
| 34 | 40 |
| 35 std::string InputMethodMac::GetInputLocale() { | 41 std::string InputMethodMac::GetInputLocale() { |
| 42 NSArray* input_locales = [[NSTextInputContext currentInputContext] allowedInpu
tSourceLocales]; |
| 43 for (NSString* s in input_locales) { |
| 44 NSLog(@"locale[i]=%@\n", s); |
| 45 } |
| 46 DLOG(INFO) << "returning"; |
| 36 return ""; | 47 return ""; |
| 37 } | 48 } |
| 38 | 49 |
| 39 bool InputMethodMac::IsActive() { | 50 bool InputMethodMac::IsActive() { |
| 40 return true; | 51 return true; |
| 41 } | 52 } |
| 42 | 53 |
| 43 bool InputMethodMac::IsCandidatePopupOpen() const { | 54 bool InputMethodMac::IsCandidatePopupOpen() const { |
| 44 // There seems to be no way to tell if a candidate window is open. | 55 // There seems to be no way to tell if a candidate window is open. |
| 45 return false; | 56 return false; |
| 46 } | 57 } |
| 47 | 58 |
| 48 } // namespace ui | 59 } // namespace ui |
| OLD | NEW |