| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/ime/text_input_focus_manager.h" | 5 #include "ui/base/ime/text_input_focus_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| 11 | 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 |
| 12 TextInputFocusManager* TextInputFocusManager::GetInstance() { | 16 TextInputFocusManager* TextInputFocusManager::GetInstance() { |
| 13 TextInputFocusManager* instance = Singleton<TextInputFocusManager>::get(); | 17 TextInputFocusManager* instance = Singleton<TextInputFocusManager>::get(); |
| 14 DCHECK(instance->thread_checker_.CalledOnValidThread()); | 18 // DCHECK(instance->thread_checker_.CalledOnValidThread()); |
| 15 return instance; | 19 return instance; |
| 16 } | 20 } |
| 17 | 21 |
| 18 TextInputClient* TextInputFocusManager::GetFocusedTextInputClient() { | 22 TextInputClient* TextInputFocusManager::GetFocusedTextInputClient() { |
| 19 DCHECK(thread_checker_.CalledOnValidThread()); | 23 // DCHECK(thread_checker_.CalledOnValidThread()); |
| 20 return focused_text_input_client_; | 24 return focused_text_input_client_; |
| 21 } | 25 } |
| 22 | 26 |
| 23 void TextInputFocusManager::FocusTextInputClient( | 27 void TextInputFocusManager::FocusTextInputClient( |
| 24 TextInputClient* text_input_client) { | 28 TextInputClient* text_input_client) { |
| 25 DCHECK(thread_checker_.CalledOnValidThread()); | 29 // DCHECK(thread_checker_.CalledOnValidThread()); |
| 26 focused_text_input_client_ = text_input_client; | 30 focused_text_input_client_ = text_input_client; |
| 27 } | 31 } |
| 28 | 32 |
| 29 void TextInputFocusManager::BlurTextInputClient( | 33 void TextInputFocusManager::BlurTextInputClient( |
| 30 TextInputClient* text_input_client) { | 34 TextInputClient* text_input_client) { |
| 31 DCHECK(thread_checker_.CalledOnValidThread()); | 35 // DCHECK(thread_checker_.CalledOnValidThread()); |
| 32 if (focused_text_input_client_ == text_input_client) | 36 if (focused_text_input_client_ == text_input_client) |
| 33 focused_text_input_client_ = NULL; | 37 focused_text_input_client_ = NULL; |
| 34 } | 38 } |
| 35 | 39 |
| 36 TextInputFocusManager::TextInputFocusManager() | 40 TextInputFocusManager::TextInputFocusManager() |
| 37 : focused_text_input_client_(NULL) {} | 41 : focused_text_input_client_(NULL) {} |
| 38 | 42 |
| 39 TextInputFocusManager::~TextInputFocusManager() {} | 43 TextInputFocusManager::~TextInputFocusManager() {} |
| 40 | 44 |
| 41 } // namespace ui | 45 } // namespace ui |
| OLD | NEW |