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

Unified Diff: ui/base/ime/text_input_focus_manager.h

Issue 173803002: Redesigns the text input focus handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments. Created 6 years, 9 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
Index: ui/base/ime/text_input_focus_manager.h
diff --git a/ui/base/ime/text_input_focus_manager.h b/ui/base/ime/text_input_focus_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..4e5f2b36bb1ea6d3bef08c6c6454d038a9d178b6
--- /dev/null
+++ b/ui/base/ime/text_input_focus_manager.h
@@ -0,0 +1,45 @@
+// Copyright 2014 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.
+
+#ifndef UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_
+#define UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_
+
+#include "base/macros.h"
+#include "ui/base/ui_base_export.h"
+
+template <typename T> struct DefaultSingletonTraits;
+
+namespace ui {
+
+class TextInputClient;
+
+// Manages the focused TextInputClient across windows and their contents.
Seigo Nonaka 2014/03/13 12:13:26 This class seems not thread safe and only designed
Yuki 2014/03/14 15:25:22 Unfortunately, either of ui/base and ui/views cann
tfarina 2014/03/14 19:58:56 I'd say, 'hopefuly' :)
Seigo Nonaka 2014/03/17 18:08:07 thread checker is in base/threading so you can use
Yuki 2014/04/16 09:24:08 Done.
+class UI_BASE_EXPORT TextInputFocusManager {
+ public:
+ static TextInputFocusManager* GetInstance();
+
+ // Returns the currently focused text input client or NULL.
+ TextInputClient* GetFocusedTextInputClient();
+
+ // Changes the text input focus to |text_input_client|.
+ void FocusTextInputClient(TextInputClient* text_input_client);
+
+ // Removes the text input focus from |text_input_client|. If
+ // |text_input_client| was not focused, does nothing.
+ void BlurTextInputClient(TextInputClient* text_input_client);
+
+ private:
+ friend struct DefaultSingletonTraits<TextInputFocusManager>;
+
+ TextInputFocusManager();
+ ~TextInputFocusManager();
+
+ TextInputClient* focused_text_input_client_;
+
+ DISALLOW_COPY_AND_ASSIGN(TextInputFocusManager);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698