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

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

Issue 375363002: Makes sure InputMethodEngine::Enable() can be called after chrome starts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change solution, mitigate risk. Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/prefs/pref_service.h" 15 #include "base/prefs/pref_service.h"
16 #include "base/strings/string_split.h" 16 #include "base/strings/string_split.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/sys_info.h" 19 #include "base/sys_info.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" 21 #include "chrome/browser/chromeos/input_method/candidate_window_controller.h"
22 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i mpl.h" 22 #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_i mpl.h"
23 #include "chrome/browser/chromeos/input_method/input_method_engine.h" 23 #include "chrome/browser/chromeos/input_method/input_method_engine.h"
24 #include "chrome/browser/chromeos/language_preferences.h" 24 #include "chrome/browser/chromeos/language_preferences.h"
25 #include "chrome/browser/chromeos/login/users/user_manager.h"
25 #include "chrome/browser/profiles/profile_manager.h" 26 #include "chrome/browser/profiles/profile_manager.h"
26 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
27 #include "chromeos/ime/component_extension_ime_manager.h" 28 #include "chromeos/ime/component_extension_ime_manager.h"
28 #include "chromeos/ime/extension_ime_util.h" 29 #include "chromeos/ime/extension_ime_util.h"
29 #include "chromeos/ime/fake_ime_keyboard.h" 30 #include "chromeos/ime/fake_ime_keyboard.h"
30 #include "chromeos/ime/ime_keyboard.h" 31 #include "chromeos/ime/ime_keyboard.h"
31 #include "chromeos/ime/input_method_delegate.h" 32 #include "chromeos/ime/input_method_delegate.h"
32 #include "third_party/icu/source/common/unicode/uloc.h" 33 #include "third_party/icu/source/common/unicode/uloc.h"
33 #include "ui/base/accelerators/accelerator.h" 34 #include "ui/base/accelerators/accelerator.h"
34 35
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 void InputMethodManagerImpl::AddInputMethodExtension( 480 void InputMethodManagerImpl::AddInputMethodExtension(
480 const std::string& id, 481 const std::string& id,
481 InputMethodEngineInterface* engine) { 482 InputMethodEngineInterface* engine) {
482 if (state_ == STATE_TERMINATING) 483 if (state_ == STATE_TERMINATING)
483 return; 484 return;
484 485
485 DCHECK(engine); 486 DCHECK(engine);
486 487
487 profile_engine_map_[GetProfile()][id] = engine; 488 profile_engine_map_[GetProfile()][id] = engine;
488 489
490 if (id == current_input_method_.id()) {
491 IMEBridge::Get()->SetCurrentEngineHandler(engine);
492 engine->Enable();
493 }
494
489 if (extension_ime_util::IsComponentExtensionIME(id)) 495 if (extension_ime_util::IsComponentExtensionIME(id))
490 return; 496 return;
491 497
492 CHECK(extension_ime_util::IsExtensionIME(id)) 498 CHECK(extension_ime_util::IsExtensionIME(id))
493 << id << "is not a valid extension input method ID"; 499 << id << "is not a valid extension input method ID";
494 500
495 const InputMethodDescriptor& descriptor = engine->GetDescriptor(); 501 const InputMethodDescriptor& descriptor = engine->GetDescriptor();
496 extra_input_methods_[id] = descriptor; 502 extra_input_methods_[id] = descriptor;
497 503
498 if (Contains(enabled_extension_imes_, id)) { 504 if (Contains(enabled_extension_imes_, id)) {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 CandidateWindowController::CreateCandidateWindowController()); 922 CandidateWindowController::CreateCandidateWindowController());
917 candidate_window_controller_->AddObserver(this); 923 candidate_window_controller_->AddObserver(this);
918 } 924 }
919 925
920 Profile* InputMethodManagerImpl::GetProfile() const { 926 Profile* InputMethodManagerImpl::GetProfile() const {
921 return ProfileManager::GetActiveUserProfile(); 927 return ProfileManager::GetActiveUserProfile();
922 } 928 }
923 929
924 } // namespace input_method 930 } // namespace input_method
925 } // namespace chromeos 931 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698