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

Unified Diff: views/ime/input_method.cc

Issue 7217008: Use input method to control visibility of virtual keyboard (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Update Created 9 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/ime/input_method.h ('k') | views/ime/input_method_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/ime/input_method.cc
diff --git a/views/ime/input_method.cc b/views/ime/input_method.cc
new file mode 100644
index 0000000000000000000000000000000000000000..77b5f1536a26e6fd4dd97224523f9f1f2c024134
--- /dev/null
+++ b/views/ime/input_method.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "views/ime/input_method.h"
+
+#include <algorithm>
+
+#include "base/logging.h"
+
+namespace views {
+
Peng 2011/06/21 15:42:53 Hi Suzhe, I added some functions into InputMethod
+void InputMethod::AddTextInputTypeChangedListener(
+ TextInputTypeChangedListener* listener) {
+ DCHECK(std::find(text_input_type_changed_listeners_.begin(),
+ text_input_type_changed_listeners_.end(), listener) ==
+ text_input_type_changed_listeners_.end()) << "Adding a listener twice.";
+ text_input_type_changed_listeners_.push_back(listener);
+}
+
+void InputMethod::RemoveTextInputTypeChangedListener(
+ TextInputTypeChangedListener* listener) {
+ TextInputTypeChangedListenerList::iterator place =
+ std::find(text_input_type_changed_listeners_.begin(),
+ text_input_type_changed_listeners_.end(),
+ listener);
+ if (place == text_input_type_changed_listeners_.end()) {
+ NOTREACHED() << "Removing a listener that isn't registered.";
+ return;
+ }
+ text_input_type_changed_listeners_.erase(place);
+}
+
+void InputMethod::TextInputTypeChanged(View *view) {
+ TextInputTypeChangedListenerList::const_iterator iter;
+ for (iter = text_input_type_changed_listeners_.begin();
+ iter != text_input_type_changed_listeners_.end(); ++iter) {
+ (*iter)->TextInputTypeChanged(view, GetTextInputType());
+ }
+}
+
+} // namespace views
« no previous file with comments | « views/ime/input_method.h ('k') | views/ime/input_method_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698