1 // Copyright 2014 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.
5 #ifndef UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_
6 #define UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_
8 #include "base/macros.h"
9 #include "base/threading/thread_checker.h"
10 #include "ui/base/ime/ui_base_ime_export.h"
12 template <typename T
> struct DefaultSingletonTraits
;
16 class TextInputClient
;
18 // Manages the focused TextInputClient across windows and their contents.
19 class UI_BASE_IME_EXPORT TextInputFocusManager
{
21 static TextInputFocusManager
* GetInstance();
23 // Returns the currently focused text input client or NULL.
24 TextInputClient
* GetFocusedTextInputClient();
26 // Changes the text input focus to |text_input_client|.
27 void FocusTextInputClient(TextInputClient
* text_input_client
);
29 // Removes the text input focus from |text_input_client|. If
30 // |text_input_client| was not focused, does nothing.
31 void BlurTextInputClient(TextInputClient
* text_input_client
);
34 friend struct DefaultSingletonTraits
<TextInputFocusManager
>;
36 TextInputFocusManager();
37 ~TextInputFocusManager();
39 TextInputClient
* focused_text_input_client_
;
40 base::ThreadChecker thread_checker_
;
42 DISALLOW_COPY_AND_ASSIGN(TextInputFocusManager
);
47 #endif // UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_