| 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_delegate_impl.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_delegate_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/threading/sequenced_worker_pool.h" | |
| 9 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| 12 #include "content/public/browser/browser_thread.h" | |
| 13 | 11 |
| 14 namespace chromeos { | 12 namespace chromeos { |
| 15 namespace input_method { | 13 namespace input_method { |
| 16 | 14 |
| 17 InputMethodDelegateImpl::InputMethodDelegateImpl() {} | 15 InputMethodDelegateImpl::InputMethodDelegateImpl() {} |
| 18 | 16 |
| 19 std::string InputMethodDelegateImpl::GetHardwareKeyboardLayout() const { | 17 std::string InputMethodDelegateImpl::GetHardwareKeyboardLayout() const { |
| 20 if (g_browser_process) { | 18 if (g_browser_process) { |
| 21 PrefServiceBase* local_state = g_browser_process->local_state(); | 19 PrefServiceBase* local_state = g_browser_process->local_state(); |
| 22 if (local_state) | 20 if (local_state) |
| 23 return local_state->GetString(prefs::kHardwareKeyboardLayout); | 21 return local_state->GetString(prefs::kHardwareKeyboardLayout); |
| 24 } | 22 } |
| 25 // This shouldn't happen but just in case. | 23 // This shouldn't happen but just in case. |
| 26 DVLOG(1) << "Local state is not yet ready."; | 24 DVLOG(1) << "Local state is not yet ready."; |
| 27 return std::string(); | 25 return std::string(); |
| 28 } | 26 } |
| 29 | 27 |
| 30 std::string InputMethodDelegateImpl::GetActiveLocale() const { | 28 std::string InputMethodDelegateImpl::GetActiveLocale() const { |
| 31 if (g_browser_process) | 29 if (g_browser_process) |
| 32 return g_browser_process->GetApplicationLocale(); | 30 return g_browser_process->GetApplicationLocale(); |
| 33 | 31 |
| 34 NOTREACHED(); | 32 NOTREACHED(); |
| 35 return std::string(); | 33 return std::string(); |
| 36 } | 34 } |
| 37 | 35 |
| 38 scoped_refptr<base::SequencedTaskRunner> | |
| 39 InputMethodDelegateImpl::GetDefaultTaskRunner() const { | |
| 40 return content::BrowserThread::GetMessageLoopProxyForThread( | |
| 41 content::BrowserThread::UI); | |
| 42 } | |
| 43 | |
| 44 scoped_refptr<base::SequencedTaskRunner> | |
| 45 InputMethodDelegateImpl::GetWorkerTaskRunner() const { | |
| 46 scoped_refptr<base::SequencedWorkerPool> worker_pool( | |
| 47 content::BrowserThread::GetBlockingPool()); | |
| 48 | |
| 49 return worker_pool->GetSequencedTaskRunner(worker_pool->GetSequenceToken()); | |
| 50 } | |
| 51 | |
| 52 } // namespace input_method | 36 } // namespace input_method |
| 53 } // namespace chromeos | 37 } // namespace chromeos |
| OLD | NEW |