Chromium Code Reviews| 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 #ifndef VIEWS_IME_INPUT_METHOD_MANAGER_H_ | |
| 6 #define VIEWS_IME_INPUT_METHOD_MANAGER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/singleton.h" | |
| 10 #include "base/observer_list.h" | |
| 11 #include "ui/base/ime/text_input_type.h" | |
| 12 | |
| 13 namespace views { | |
| 14 | |
| 15 class View; | |
|
James Su
2011/07/07 02:03:03
nit: remove this line.
Peng
2011/07/07 17:56:54
Done.
| |
| 16 class Widget; | |
| 17 | |
| 18 class TextInputTypeChangedListener { | |
|
James Su
2011/07/07 02:03:03
nit: How about call it TextInputTypeObserver?
And
Peng
2011/07/07 17:56:54
Done.
| |
| 19 public: | |
| 20 virtual void TextInputTypeChanged(ui::TextInputType type, Widget* widget) = 0; | |
|
James Su
2011/07/07 02:03:03
nit: Add some comment? e.g. clarify in what situat
Peng
2011/07/07 17:56:54
Done.
| |
| 21 | |
| 22 protected: | |
| 23 virtual ~TextInputTypeChangedListener() {} | |
| 24 }; | |
| 25 | |
| 26 class InputMethodManager { | |
|
James Su
2011/07/07 02:03:03
How about to rename this class to something more s
| |
| 27 public: | |
| 28 // Returns the singleton instance. | |
| 29 static InputMethodManager* GetInstance(); | |
| 30 | |
| 31 // Adds/removes a TextInputTypeChangedListener |listener| to the set of | |
| 32 // active listeners. | |
| 33 void AddTextInputTypeChangedListener(TextInputTypeChangedListener* listener); | |
|
James Su
2011/07/07 02:03:03
nit: AddTextInputTypeObserver(...);
Peng
2011/07/07 17:56:54
Done.
| |
| 34 void RemoveTextInputTypeChangedListener( | |
|
James Su
2011/07/07 02:03:03
ditto
Peng
2011/07/07 17:56:54
Done.
| |
| 35 TextInputTypeChangedListener* listener); | |
| 36 | |
| 37 void OnTextInputTypeChanged(ui::TextInputType type, Widget* widget); | |
|
James Su
2011/07/07 02:03:03
nit: add comment to clarify whom will call this me
Peng
2011/07/07 17:56:54
Done.
| |
| 38 | |
| 39 private: | |
| 40 InputMethodManager(); | |
| 41 ~InputMethodManager(); | |
| 42 | |
| 43 ObserverList<TextInputTypeChangedListener> text_input_type_changed_listeners_; | |
| 44 | |
| 45 friend struct DefaultSingletonTraits<InputMethodManager>; | |
| 46 DISALLOW_COPY_AND_ASSIGN(InputMethodManager); | |
| 47 }; | |
| 48 | |
| 49 } // namespace views | |
| 50 | |
| 51 #endif // VIEWS_IME_INPUT_METHOD_MANAGER_H_ | |
| OLD | NEW |