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. 4 5#ifndef UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_ 6#define UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_ 7 8#include "base/macros.h" 9#include "base/threading/thread_checker.h" 10#include "ui/base/ui_base_export.h" 11 12template <typename T> struct DefaultSingletonTraits; 13 14namespace ui { 15 16class TextInputClient; 17 18// Manages the focused TextInputClient across windows and their contents. 19class UI_BASE_EXPORT TextInputFocusManager { 20 public: 21 static TextInputFocusManager* GetInstance(); 22 23 // Returns the currently focused text input client or NULL. 24 TextInputClient* GetFocusedTextInputClient(); 25 26 // Changes the text input focus to |text_input_client|. 27 void FocusTextInputClient(TextInputClient* text_input_client); 28 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); 32 33 private: 34 friend struct DefaultSingletonTraits<TextInputFocusManager>; 35 36 TextInputFocusManager(); 37 ~TextInputFocusManager(); 38 39 TextInputClient* focused_text_input_client_; 40 base::ThreadChecker thread_checker_; 41 42 DISALLOW_COPY_AND_ASSIGN(TextInputFocusManager); 43}; 44 45} // namespace ui 46 47#endif // UI_BASE_IME_TEXT_INPUT_FOCUS_MANAGER_H_ 48