| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/input_method/input_method_manager.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/input_method/input_method_delegate_impl.h" |
| 7 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h" |
| 8 | 9 |
| 9 namespace chromeos { | 10 namespace chromeos { |
| 10 namespace input_method { | 11 namespace input_method { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 InputMethodManager* g_input_method_manager = NULL; | 14 InputMethodManager* g_input_method_manager = NULL; |
| 14 } // namespace | 15 } // namespace |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 void InputMethodManager::Initialize() { | 18 void InputMethodManager::Initialize() { |
| 18 DCHECK(!g_input_method_manager); | 19 DCHECK(!g_input_method_manager); |
| 19 InputMethodManagerImpl* impl = new InputMethodManagerImpl; | 20 InputMethodManagerImpl* impl = new InputMethodManagerImpl( |
| 21 scoped_ptr<InputMethodDelegate>(new InputMethodDelegateImpl)); |
| 20 impl->Init(); | 22 impl->Init(); |
| 21 g_input_method_manager = impl; | 23 g_input_method_manager = impl; |
| 22 DVLOG(1) << "InputMethodManager initialized"; | 24 DVLOG(1) << "InputMethodManager initialized"; |
| 23 } | 25 } |
| 24 | 26 |
| 25 // static | 27 // static |
| 26 void InputMethodManager::InitializeForTesting( | 28 void InputMethodManager::InitializeForTesting( |
| 27 InputMethodManager* mock_manager) { | 29 InputMethodManager* mock_manager) { |
| 28 DCHECK(!g_input_method_manager); | 30 DCHECK(!g_input_method_manager); |
| 29 g_input_method_manager = mock_manager; | 31 g_input_method_manager = mock_manager; |
| 30 DVLOG(1) << "InputMethodManager for testing initialized"; | 32 DVLOG(1) << "InputMethodManager for testing initialized"; |
| 31 } | 33 } |
| 32 | 34 |
| 33 // static | 35 // static |
| 34 void InputMethodManager::Shutdown() { | 36 void InputMethodManager::Shutdown() { |
| 35 delete g_input_method_manager; | 37 delete g_input_method_manager; |
| 36 g_input_method_manager = NULL; | 38 g_input_method_manager = NULL; |
| 37 DVLOG(1) << "InputMethodManager shutdown"; | 39 DVLOG(1) << "InputMethodManager shutdown"; |
| 38 } | 40 } |
| 39 | 41 |
| 40 // static | 42 // static |
| 41 InputMethodManager* InputMethodManager::GetInstance() { | 43 InputMethodManager* InputMethodManager::GetInstance() { |
| 42 DCHECK(g_input_method_manager); | 44 DCHECK(g_input_method_manager); |
| 43 return g_input_method_manager; | 45 return g_input_method_manager; |
| 44 } | 46 } |
| 45 | 47 |
| 46 } // namespace input_method | 48 } // namespace input_method |
| 47 } // namespace chromeos | 49 } // namespace chromeos |
| OLD | NEW |