OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "views/ime/input_method.h" | |
6 | |
7 #include <algorithm> | |
8 | |
9 #include "base/logging.h" | |
10 | |
11 namespace views { | |
12 | |
Peng
2011/06/21 15:42:53
Hi Suzhe, I added some functions into InputMethod
| |
13 void InputMethod::AddTextInputTypeChangedListener( | |
14 TextInputTypeChangedListener* listener) { | |
15 DCHECK(std::find(text_input_type_changed_listeners_.begin(), | |
16 text_input_type_changed_listeners_.end(), listener) == | |
17 text_input_type_changed_listeners_.end()) << "Adding a listener twice."; | |
18 text_input_type_changed_listeners_.push_back(listener); | |
19 } | |
20 | |
21 void InputMethod::RemoveTextInputTypeChangedListener( | |
22 TextInputTypeChangedListener* listener) { | |
23 TextInputTypeChangedListenerList::iterator place = | |
24 std::find(text_input_type_changed_listeners_.begin(), | |
25 text_input_type_changed_listeners_.end(), | |
26 listener); | |
27 if (place == text_input_type_changed_listeners_.end()) { | |
28 NOTREACHED() << "Removing a listener that isn't registered."; | |
29 return; | |
30 } | |
31 text_input_type_changed_listeners_.erase(place); | |
32 } | |
33 | |
34 void InputMethod::TextInputTypeChanged(View *view) { | |
35 TextInputTypeChangedListenerList::const_iterator iter; | |
36 for (iter = text_input_type_changed_listeners_.begin(); | |
37 iter != text_input_type_changed_listeners_.end(); ++iter) { | |
38 (*iter)->TextInputTypeChanged(view, GetTextInputType()); | |
39 } | |
40 } | |
41 | |
42 } // namespace views | |
OLD | NEW |