| 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/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "ui/base/ime/input_method_delegate.h" | 8 #include "ui/base/ime/input_method_delegate.h" | 
| 9 #include "ui/base/ime/input_method_observer.h" | 9 #include "ui/base/ime/input_method_observer.h" | 
| 10 #include "ui/base/ime/text_input_client.h" | 10 #include "ui/base/ime/text_input_client.h" | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 55 TextInputClient* InputMethodBase::GetTextInputClient() const { | 55 TextInputClient* InputMethodBase::GetTextInputClient() const { | 
| 56   return system_toplevel_window_focused_ ? text_input_client_ : NULL; | 56   return system_toplevel_window_focused_ ? text_input_client_ : NULL; | 
| 57 } | 57 } | 
| 58 | 58 | 
| 59 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { | 59 void InputMethodBase::OnTextInputTypeChanged(const TextInputClient* client) { | 
| 60   if (!IsTextInputClientFocused(client)) | 60   if (!IsTextInputClientFocused(client)) | 
| 61     return; | 61     return; | 
| 62   NotifyTextInputStateChanged(client); | 62   NotifyTextInputStateChanged(client); | 
| 63 } | 63 } | 
| 64 | 64 | 
| 65 void InputMethodBase::OnCaretBoundsChanged(const TextInputClient* client) { |  | 
| 66   if (!IsTextInputClientFocused(client)) |  | 
| 67     return; |  | 
| 68   FOR_EACH_OBSERVER(InputMethodObserver, |  | 
| 69                     observer_list_, |  | 
| 70                     OnCaretBoundsChanged(client)); |  | 
| 71 } |  | 
| 72 |  | 
| 73 TextInputType InputMethodBase::GetTextInputType() const { | 65 TextInputType InputMethodBase::GetTextInputType() const { | 
| 74   TextInputClient* client = GetTextInputClient(); | 66   TextInputClient* client = GetTextInputClient(); | 
| 75   return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE; | 67   return client ? client->GetTextInputType() : TEXT_INPUT_TYPE_NONE; | 
| 76 } | 68 } | 
| 77 | 69 | 
| 78 TextInputMode InputMethodBase::GetTextInputMode() const { | 70 TextInputMode InputMethodBase::GetTextInputMode() const { | 
| 79   TextInputClient* client = GetTextInputClient(); | 71   TextInputClient* client = GetTextInputClient(); | 
| 80   return client ? client->GetTextInputMode() : TEXT_INPUT_MODE_DEFAULT; | 72   return client ? client->GetTextInputMode() : TEXT_INPUT_MODE_DEFAULT; | 
| 81 } | 73 } | 
| 82 | 74 | 
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 131   TextInputClient* old = text_input_client_; | 123   TextInputClient* old = text_input_client_; | 
| 132   if (old == client) | 124   if (old == client) | 
| 133     return; | 125     return; | 
| 134   OnWillChangeFocusedClient(old, client); | 126   OnWillChangeFocusedClient(old, client); | 
| 135   text_input_client_ = client;  // NULL allowed. | 127   text_input_client_ = client;  // NULL allowed. | 
| 136   OnDidChangeFocusedClient(old, client); | 128   OnDidChangeFocusedClient(old, client); | 
| 137   NotifyTextInputStateChanged(text_input_client_); | 129   NotifyTextInputStateChanged(text_input_client_); | 
| 138 } | 130 } | 
| 139 | 131 | 
| 140 }  // namespace ui | 132 }  // namespace ui | 
| OLD | NEW | 
|---|