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

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

Issue 187313002: Update StickyKeys overlay to show or hide AltGr depending on the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix broken unittest Created 6 years, 9 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 | Annotate | Revision Log
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 19 matching lines...) Expand all
30 #include "ui/base/accelerators/accelerator.h" 30 #include "ui/base/accelerators/accelerator.h"
31 31
32 namespace chromeos { 32 namespace chromeos {
33 namespace input_method { 33 namespace input_method {
34 34
35 namespace { 35 namespace {
36 36
37 const char nacl_mozc_jp_id[] = 37 const char nacl_mozc_jp_id[] =
38 "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp"; 38 "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_jp";
39 39
40 const char *kMod3LayoutIds[] = {
41 "xkb:de:neo:ger",
42 "xkb:ca:multix:fra",
43 };
44
45 const char *kAltGrLayoutIds[] = {
46 "xkb:be::fra",
Seigo Nonaka 2014/03/12 19:00:00 Whoa! these xkb IDs are no longer available!(excep
47 "xkb:be::ger",
48 "xkb:be::nld",
49 "xkb:bg::bul",
50 "xkb:bg:phonetic:bul",
51 "xkb:br::por",
52 "xkb:ca::fra",
53 "xkb:ca:eng:eng",
54 "xkb:ca:multix:fra",
55 "xkb:ch::ger",
56 "xkb:ch:fr:fra",
57 "xkb:cz::cze",
58 "xkb:de::ger",
59 "xkb:de:neo:ger",
60 "xkb:dk::dan",
61 "xkb:ee::est",
62 "xkb:es::spa",
63 "xkb:es:cat:cat",
64 "xkb:fi::fin",
65 "xkb:fr::fra",
66 "xkb:gb:dvorak:eng",
67 "xkb:gb:extd:eng",
68 "xkb:gr::gre",
69 "xkb:hr::scr",
70 "xkb:il::heb",
71 "xkb:it::ita",
72 "xkb:latam::spa",
73 "xkb:lt::lit",
74 "xkb:no::nob",
75 "xkb:pl::pol",
76 "xkb:pt::por",
77 "xkb:ro::rum",
78 "xkb:se::swe",
79 "xkb:si::slv",
80 "xkb:sk::slo",
81 "xkb:tr::tur",
82 "xkb:ua::ukr",
83 "xkb:us:altgr-intl:eng",
84 "xkb:us:intl:eng",
85 };
86
40 bool Contains(const std::vector<std::string>& container, 87 bool Contains(const std::vector<std::string>& container,
41 const std::string& value) { 88 const std::string& value) {
42 return std::find(container.begin(), container.end(), value) != 89 return std::find(container.begin(), container.end(), value) !=
43 container.end(); 90 container.end();
44 } 91 }
45 92
46 } // namespace 93 } // namespace
47 94
48 bool InputMethodManagerImpl::IsLoginKeyboard( 95 bool InputMethodManagerImpl::IsLoginKeyboard(
49 const std::string& layout) const { 96 const std::string& layout) const {
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 ChangeInputMethodInternal(*iter, true); 755 ChangeInputMethodInternal(*iter, true);
709 } 756 }
710 757
711 InputMethodDescriptor InputMethodManagerImpl::GetCurrentInputMethod() const { 758 InputMethodDescriptor InputMethodManagerImpl::GetCurrentInputMethod() const {
712 if (current_input_method_.id().empty()) 759 if (current_input_method_.id().empty())
713 return InputMethodUtil::GetFallbackInputMethodDescriptor(); 760 return InputMethodUtil::GetFallbackInputMethodDescriptor();
714 761
715 return current_input_method_; 762 return current_input_method_;
716 } 763 }
717 764
765 bool InputMethodManagerImpl::IsMod3UsedByCurrentInputMethod() const {
766 for (size_t i = 0; i < arraysize(kMod3LayoutIds); ++i) {
767 if (GetCurrentInputMethod().id() == kMod3LayoutIds[i])
Seigo Nonaka 2014/03/12 19:00:00 Hmm, I don't think this works with third-party IME
768 return true;
769 }
770 return false;
771 }
772
773 bool InputMethodManagerImpl::IsAltGrUsedByCurrentInputMethod() const {
774 for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) {
775 if (GetCurrentInputMethod().id() == kAltGrLayoutIds[i])
776 return true;
777 }
778 return false;
779 }
780
718 XKeyboard* InputMethodManagerImpl::GetXKeyboard() { 781 XKeyboard* InputMethodManagerImpl::GetXKeyboard() {
719 return xkeyboard_.get(); 782 return xkeyboard_.get();
720 } 783 }
721 784
722 InputMethodUtil* InputMethodManagerImpl::GetInputMethodUtil() { 785 InputMethodUtil* InputMethodManagerImpl::GetInputMethodUtil() {
723 return &util_; 786 return &util_;
724 } 787 }
725 788
726 ComponentExtensionIMEManager* 789 ComponentExtensionIMEManager*
727 InputMethodManagerImpl::GetComponentExtensionIMEManager() { 790 InputMethodManagerImpl::GetComponentExtensionIMEManager() {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 if (candidate_window_controller_.get()) 904 if (candidate_window_controller_.get())
842 return; 905 return;
843 906
844 candidate_window_controller_.reset( 907 candidate_window_controller_.reset(
845 CandidateWindowController::CreateCandidateWindowController()); 908 CandidateWindowController::CreateCandidateWindowController());
846 candidate_window_controller_->AddObserver(this); 909 candidate_window_controller_->AddObserver(this);
847 } 910 }
848 911
849 } // namespace input_method 912 } // namespace input_method
850 } // namespace chromeos 913 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698