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

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

Issue 306053005: Adds whitelisted non-extension-based input methods if no component extensions are at present (e.g. … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed test failures. Created 6 years, 6 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 case STATE_TERMINATING: { 106 case STATE_TERMINATING: {
107 if (candidate_window_controller_.get()) 107 if (candidate_window_controller_.get())
108 candidate_window_controller_.reset(); 108 candidate_window_controller_.reset();
109 break; 109 break;
110 } 110 }
111 } 111 }
112 } 112 }
113 113
114 scoped_ptr<InputMethodDescriptors> 114 scoped_ptr<InputMethodDescriptors>
115 InputMethodManagerImpl::GetSupportedInputMethods() const { 115 InputMethodManagerImpl::GetSupportedInputMethods() const {
116 scoped_ptr<InputMethodDescriptors> whitelist_imes = 116 if (!extension_ime_util::UseWrappedExtensionKeyboardLayouts() ||
117 whitelist_.GetSupportedInputMethods(); 117 !component_extension_ime_manager_->IsInitialized())
118 if (!extension_ime_util::UseWrappedExtensionKeyboardLayouts()) 118 return whitelist_.GetSupportedInputMethods().Pass();
Yuki 2014/06/02 06:28:52 No need to call Pass() for temporary objects. http
Shu Chen 2014/06/02 09:45:02 Done.
119 return whitelist_imes.Pass();
120 return scoped_ptr<InputMethodDescriptors>(new InputMethodDescriptors).Pass(); 119 return scoped_ptr<InputMethodDescriptors>(new InputMethodDescriptors).Pass();
121 } 120 }
122 121
123 scoped_ptr<InputMethodDescriptors> 122 scoped_ptr<InputMethodDescriptors>
124 InputMethodManagerImpl::GetActiveInputMethods() const { 123 InputMethodManagerImpl::GetActiveInputMethods() const {
125 scoped_ptr<InputMethodDescriptors> result(new InputMethodDescriptors); 124 scoped_ptr<InputMethodDescriptors> result(new InputMethodDescriptors);
126 // Build the active input method descriptors from the active input 125 // Build the active input method descriptors from the active input
127 // methods cache |active_input_method_ids_|. 126 // methods cache |active_input_method_ids_|.
128 for (size_t i = 0; i < active_input_method_ids_.size(); ++i) { 127 for (size_t i = 0; i < active_input_method_ids_.size(); ++i) {
129 const std::string& input_method_id = active_input_method_ids_[i]; 128 const std::string& input_method_id = active_input_method_ids_[i];
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 DCHECK(!input_methods->empty()); 321 DCHECK(!input_methods->empty());
323 input_method_id_to_switch = input_methods->at(0).id(); 322 input_method_id_to_switch = input_methods->at(0).id();
324 if (!input_method_id.empty()) { 323 if (!input_method_id.empty()) {
325 DVLOG(1) << "Can't change the current input method to " 324 DVLOG(1) << "Can't change the current input method to "
326 << input_method_id << " since the engine is not enabled. " 325 << input_method_id << " since the engine is not enabled. "
327 << "Switch to " << input_method_id_to_switch << " instead."; 326 << "Switch to " << input_method_id_to_switch << " instead.";
328 } 327 }
329 } 328 }
330 329
331 if (!component_extension_ime_manager_->IsInitialized() && 330 if (!component_extension_ime_manager_->IsInitialized() &&
332 (!InputMethodUtil::IsKeyboardLayout(input_method_id_to_switch) || 331 !InputMethodUtil::IsKeyboardLayout(input_method_id_to_switch)) {
333 extension_ime_util::IsKeyboardLayoutExtension(
334 input_method_id_to_switch))) {
335 // We can't change input method before the initialization of 332 // We can't change input method before the initialization of
336 // component extension ime manager. ChangeInputMethod will be 333 // component extension ime manager. ChangeInputMethod will be
337 // called with |pending_input_method_| when the initialization is 334 // called with |pending_input_method_| when the initialization is
338 // done. 335 // done.
339 pending_input_method_ = input_method_id_to_switch; 336 pending_input_method_ = input_method_id_to_switch;
340 return false; 337 return false;
341 } 338 }
342 pending_input_method_.clear(); 339 pending_input_method_.clear();
343 340
344 // Hide candidate window and info list. 341 // Hide candidate window and info list.
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 CandidateWindowController::CreateCandidateWindowController()); 851 CandidateWindowController::CreateCandidateWindowController());
855 candidate_window_controller_->AddObserver(this); 852 candidate_window_controller_->AddObserver(this);
856 } 853 }
857 854
858 Profile* InputMethodManagerImpl::GetProfile() const { 855 Profile* InputMethodManagerImpl::GetProfile() const {
859 return ProfileManager::GetActiveUserProfile(); 856 return ProfileManager::GetActiveUserProfile();
860 } 857 }
861 858
862 } // namespace input_method 859 } // namespace input_method
863 } // namespace chromeos 860 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698