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/extensions/api/input_ime/input_ime_api.h" | 5 #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 component.options_page_url, | 383 component.options_page_url, |
384 component.input_view_url)); | 384 component.input_view_url)); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 scoped_ptr<chromeos::InputMethodEngineInterface::Observer> observer( | 388 scoped_ptr<chromeos::InputMethodEngineInterface::Observer> observer( |
389 new chromeos::ImeObserver(extension_id)); | 389 new chromeos::ImeObserver(extension_id)); |
390 chromeos::InputMethodEngine* engine = new chromeos::InputMethodEngine(); | 390 chromeos::InputMethodEngine* engine = new chromeos::InputMethodEngine(); |
391 engine->Initialize(observer.Pass(), extension_id.c_str()); | 391 engine->Initialize(observer.Pass(), extension_id.c_str()); |
392 engine_map_[extension_id] = engine; | 392 engine_map_[extension_id] = engine; |
393 manager->AddInputMethodExtension(extension_id, descriptors, engine); | 393 manager->GetActiveIMEState()->AddInputMethodExtension( |
| 394 extension_id, descriptors, engine); |
394 | 395 |
395 return true; | 396 return true; |
396 #else | 397 #else |
397 // TODO(spang): IME support under ozone. | 398 // TODO(spang): IME support under ozone. |
398 NOTIMPLEMENTED(); | 399 NOTIMPLEMENTED(); |
399 return false; | 400 return false; |
400 #endif | 401 #endif |
401 } | 402 } |
402 | 403 |
403 void InputImeEventRouter::UnregisterAllImes(const std::string& extension_id) { | 404 void InputImeEventRouter::UnregisterAllImes(const std::string& extension_id) { |
404 std::map<std::string, InputMethodEngineInterface*>::iterator it = | 405 std::map<std::string, InputMethodEngineInterface*>::iterator it = |
405 engine_map_.find(extension_id); | 406 engine_map_.find(extension_id); |
406 if (it != engine_map_.end()) { | 407 if (it != engine_map_.end()) { |
407 chromeos::input_method::InputMethodManager::Get() | 408 chromeos::input_method::InputMethodManager::Get() |
| 409 ->GetActiveIMEState() |
408 ->RemoveInputMethodExtension(extension_id); | 410 ->RemoveInputMethodExtension(extension_id); |
409 delete it->second; | 411 delete it->second; |
410 engine_map_.erase(it); | 412 engine_map_.erase(it); |
411 } | 413 } |
412 } | 414 } |
413 | 415 |
414 InputMethodEngineInterface* InputImeEventRouter::GetEngine( | 416 InputMethodEngineInterface* InputImeEventRouter::GetEngine( |
415 const std::string& extension_id, | 417 const std::string& extension_id, |
416 const std::string& component_id) { | 418 const std::string& component_id) { |
417 std::map<std::string, InputMethodEngineInterface*>::iterator it = | 419 std::map<std::string, InputMethodEngineInterface*>::iterator it = |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 // Notifies the IME extension for IME ready with onActivate/onFocus events. | 853 // Notifies the IME extension for IME ready with onActivate/onFocus events. |
852 if (engine) | 854 if (engine) |
853 engine->Enable(engine->GetActiveComponentId()); | 855 engine->Enable(engine->GetActiveComponentId()); |
854 } | 856 } |
855 | 857 |
856 InputImeEventRouter* InputImeAPI::input_ime_event_router() { | 858 InputImeEventRouter* InputImeAPI::input_ime_event_router() { |
857 return InputImeEventRouter::GetInstance(); | 859 return InputImeEventRouter::GetInstance(); |
858 } | 860 } |
859 | 861 |
860 } // namespace extensions | 862 } // namespace extensions |
OLD | NEW |