• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "ui/base/ime/text_input_focus_manager.h"
6 
7 #include "base/logging.h"
8 #include "base/memory/singleton.h"
9 
10 namespace ui {
11 
12 // TODO(sky): reenable these DCHECKs. We're in the process of enabling usage
13 // of views from multiple threads and this causes problems. See
14 // http://crbug.com/388045 for details.
15 
GetInstance()16 TextInputFocusManager* TextInputFocusManager::GetInstance() {
17   TextInputFocusManager* instance = Singleton<TextInputFocusManager>::get();
18   // DCHECK(instance->thread_checker_.CalledOnValidThread());
19   return instance;
20 }
21 
GetFocusedTextInputClient()22 TextInputClient* TextInputFocusManager::GetFocusedTextInputClient() {
23   // DCHECK(thread_checker_.CalledOnValidThread());
24   return focused_text_input_client_;
25 }
26 
FocusTextInputClient(TextInputClient * text_input_client)27 void TextInputFocusManager::FocusTextInputClient(
28     TextInputClient* text_input_client) {
29   // DCHECK(thread_checker_.CalledOnValidThread());
30   focused_text_input_client_ = text_input_client;
31 }
32 
BlurTextInputClient(TextInputClient * text_input_client)33 void TextInputFocusManager::BlurTextInputClient(
34     TextInputClient* text_input_client) {
35   // DCHECK(thread_checker_.CalledOnValidThread());
36   if (focused_text_input_client_ == text_input_client)
37     focused_text_input_client_ = NULL;
38 }
39 
TextInputFocusManager()40 TextInputFocusManager::TextInputFocusManager()
41     : focused_text_input_client_(NULL) {}
42 
~TextInputFocusManager()43 TextInputFocusManager::~TextInputFocusManager() {}
44 
45 }  // namespace ui
46