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/extensions/input_method_api.h" | 5 #include "chrome/browser/chromeos/extensions/input_method_api.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 8 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
9 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" | 9 #include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_system.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 | 13 |
13 namespace extensions { | 14 namespace extensions { |
14 | 15 |
15 GetInputMethodFunction::GetInputMethodFunction() { | 16 GetInputMethodFunction::GetInputMethodFunction() { |
16 } | 17 } |
17 | 18 |
18 GetInputMethodFunction::~GetInputMethodFunction() { | 19 GetInputMethodFunction::~GetInputMethodFunction() { |
19 } | 20 } |
20 | 21 |
21 bool GetInputMethodFunction::RunImpl() { | 22 bool GetInputMethodFunction::RunImpl() { |
22 #if !defined(OS_CHROMEOS) | 23 #if !defined(OS_CHROMEOS) |
23 NOTREACHED(); | 24 NOTREACHED(); |
24 return false; | 25 return false; |
25 #else | 26 #else |
26 chromeos::ExtensionInputMethodEventRouter* router = | 27 chromeos::ExtensionInputMethodEventRouter* router = |
27 profile_->GetExtensionService()->input_method_event_router(); | 28 extensions::ExtensionSystem::Get(profile_)->extension_service()-> |
| 29 input_method_event_router(); |
28 chromeos::input_method::InputMethodManager* manager = | 30 chromeos::input_method::InputMethodManager* manager = |
29 chromeos::input_method::InputMethodManager::GetInstance(); | 31 chromeos::input_method::InputMethodManager::GetInstance(); |
30 const std::string input_method = | 32 const std::string input_method = |
31 router->GetInputMethodForXkb(manager->GetCurrentInputMethod().id()); | 33 router->GetInputMethodForXkb(manager->GetCurrentInputMethod().id()); |
32 SetResult(Value::CreateStringValue(input_method)); | 34 SetResult(Value::CreateStringValue(input_method)); |
33 return true; | 35 return true; |
34 #endif | 36 #endif |
35 } | 37 } |
36 | 38 |
37 } // namespace extensions | 39 } // namespace extensions |
OLD | NEW |