Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_manager_impl.cc

Issue 467073002: Only initialize the input method list for once, no need to re-initialize for each profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_impl.h" 5 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
6 6
7 #include <algorithm> // std::find 7 #include <algorithm> // std::find
8 8
9 #include "ash/ime/input_method_menu_item.h" 9 #include "ash/ime/input_method_menu_item.h"
10 #include "ash/ime/input_method_menu_manager.h" 10 #include "ash/ime/input_method_menu_manager.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 InputMethodManagerImpl::InputMethodManagerImpl( 59 InputMethodManagerImpl::InputMethodManagerImpl(
60 scoped_ptr<InputMethodDelegate> delegate) 60 scoped_ptr<InputMethodDelegate> delegate)
61 : delegate_(delegate.Pass()), 61 : delegate_(delegate.Pass()),
62 state_(STATE_LOGIN_SCREEN), 62 state_(STATE_LOGIN_SCREEN),
63 util_(delegate_.get()), 63 util_(delegate_.get()),
64 component_extension_ime_manager_(new ComponentExtensionIMEManager()) { 64 component_extension_ime_manager_(new ComponentExtensionIMEManager()) {
65 if (base::SysInfo::IsRunningOnChromeOS()) 65 if (base::SysInfo::IsRunningOnChromeOS())
66 keyboard_.reset(ImeKeyboard::Create()); 66 keyboard_.reset(ImeKeyboard::Create());
67 else 67 else
68 keyboard_.reset(new FakeImeKeyboard()); 68 keyboard_.reset(new FakeImeKeyboard());
69
70 // Initializes the system IME list.
71 scoped_ptr<ComponentExtensionIMEManagerDelegate> comp_delegate(
72 new ComponentExtensionIMEManagerImpl());
73 component_extension_ime_manager_->Initialize(comp_delegate.Pass());
74 util_.ResetInputMethods(
75 component_extension_ime_manager_->GetAllIMEAsInputMethodDescriptor());
69 } 76 }
70 77
71 InputMethodManagerImpl::~InputMethodManagerImpl() { 78 InputMethodManagerImpl::~InputMethodManagerImpl() {
72 if (candidate_window_controller_.get()) 79 if (candidate_window_controller_.get())
73 candidate_window_controller_->RemoveObserver(this); 80 candidate_window_controller_->RemoveObserver(this);
74 } 81 }
75 82
76 void InputMethodManagerImpl::AddObserver( 83 void InputMethodManagerImpl::AddObserver(
77 InputMethodManager::Observer* observer) { 84 InputMethodManager::Observer* observer) {
78 observers_.AddObserver(observer); 85 observers_.AddObserver(observer);
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 796
790 InputMethodUtil* InputMethodManagerImpl::GetInputMethodUtil() { 797 InputMethodUtil* InputMethodManagerImpl::GetInputMethodUtil() {
791 return &util_; 798 return &util_;
792 } 799 }
793 800
794 ComponentExtensionIMEManager* 801 ComponentExtensionIMEManager*
795 InputMethodManagerImpl::GetComponentExtensionIMEManager() { 802 InputMethodManagerImpl::GetComponentExtensionIMEManager() {
796 return component_extension_ime_manager_.get(); 803 return component_extension_ime_manager_.get();
797 } 804 }
798 805
799 void InputMethodManagerImpl::InitializeComponentExtension() {
800 scoped_ptr<ComponentExtensionIMEManagerDelegate> delegate(
801 new ComponentExtensionIMEManagerImpl());
802 component_extension_ime_manager_->Initialize(delegate.Pass());
803
804 util_.ResetInputMethods(
805 component_extension_ime_manager_->GetAllIMEAsInputMethodDescriptor());
806 }
807
808 void InputMethodManagerImpl::SetCandidateWindowControllerForTesting( 806 void InputMethodManagerImpl::SetCandidateWindowControllerForTesting(
809 CandidateWindowController* candidate_window_controller) { 807 CandidateWindowController* candidate_window_controller) {
810 candidate_window_controller_.reset(candidate_window_controller); 808 candidate_window_controller_.reset(candidate_window_controller);
811 candidate_window_controller_->AddObserver(this); 809 candidate_window_controller_->AddObserver(this);
812 } 810 }
813 811
814 void InputMethodManagerImpl::SetImeKeyboardForTesting(ImeKeyboard* keyboard) { 812 void InputMethodManagerImpl::SetImeKeyboardForTesting(ImeKeyboard* keyboard) {
815 keyboard_.reset(keyboard); 813 keyboard_.reset(keyboard);
816 } 814 }
817 815
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 if (candidate_window_controller_.get()) 891 if (candidate_window_controller_.get())
894 return; 892 return;
895 893
896 candidate_window_controller_.reset( 894 candidate_window_controller_.reset(
897 CandidateWindowController::CreateCandidateWindowController()); 895 CandidateWindowController::CreateCandidateWindowController());
898 candidate_window_controller_->AddObserver(this); 896 candidate_window_controller_->AddObserver(this);
899 } 897 }
900 898
901 } // namespace input_method 899 } // namespace input_method
902 } // namespace chromeos 900 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698