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

Side by Side Diff: chrome/browser/ui/ash/event_rewriter.cc

Issue 16222002: Add Canadian Multilingual Keyboard as Caps rewrite exception. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« 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/ui/ash/event_rewriter.h" 5 #include "chrome/browser/ui/ash/event_rewriter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 26 matching lines...) Expand all
37 #include "ui/base/keycodes/keyboard_code_conversion_x.h" 37 #include "ui/base/keycodes/keyboard_code_conversion_x.h"
38 #include "ui/base/x/x11_util.h" 38 #include "ui/base/x/x11_util.h"
39 #endif 39 #endif
40 40
41 namespace { 41 namespace {
42 42
43 const int kBadDeviceId = -1; 43 const int kBadDeviceId = -1;
44 44
45 #if defined(OS_CHROMEOS) 45 #if defined(OS_CHROMEOS)
46 const char kNeo2LayoutId[] = "xkb:de:neo:ger"; 46 const char kNeo2LayoutId[] = "xkb:de:neo:ger";
47 const char kCaMultixLayoutId[] = "xkb:ca:multix:fra";
47 48
48 // A key code and a flag we should use when a key is remapped to |remap_to|. 49 // A key code and a flag we should use when a key is remapped to |remap_to|.
49 const struct ModifierRemapping { 50 const struct ModifierRemapping {
50 int remap_to; 51 int remap_to;
51 int flag; 52 int flag;
52 unsigned int native_modifier; 53 unsigned int native_modifier;
53 ui::KeyboardCode keycode; 54 ui::KeyboardCode keycode;
54 KeySym native_keysyms[4]; // left, right, shift+left, shift+right. 55 KeySym native_keysyms[4]; // left, right, shift+left, shift+right.
55 } kModifierRemappings[] = { 56 } kModifierRemappings[] = {
56 { chromeos::input_method::kSearchKey, 0, Mod4Mask, ui::VKEY_LWIN, 57 { chromeos::input_method::kSearchKey, 0, Mod4Mask, ui::VKEY_LWIN,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 bool HasDiamondKey() { 118 bool HasDiamondKey() {
118 return CommandLine::ForCurrentProcess()->HasSwitch( 119 return CommandLine::ForCurrentProcess()->HasSwitch(
119 chromeos::switches::kHasChromeOSDiamondKey); 120 chromeos::switches::kHasChromeOSDiamondKey);
120 } 121 }
121 122
122 bool IsMod3UsedByCurrentInputMethod() { 123 bool IsMod3UsedByCurrentInputMethod() {
123 // Since both German Neo2 XKB layout and Caps Lock depend on Mod3Mask, 124 // Since both German Neo2 XKB layout and Caps Lock depend on Mod3Mask,
124 // it's not possible to make both features work. For now, we don't remap 125 // it's not possible to make both features work. For now, we don't remap
125 // Mod3Mask when Neo2 is in use. 126 // Mod3Mask when Neo2 is in use.
126 // TODO(yusukes): Remove the restriction. 127 // TODO(yusukes): Remove the restriction.
127 return chromeos::input_method::InputMethodManager::Get() 128 chromeos::input_method::InputMethodManager* manager =
128 ->GetCurrentInputMethod().id() == kNeo2LayoutId; 129 chromeos::input_method::InputMethodManager::Get();
130 return manager->GetCurrentInputMethod().id() == kNeo2LayoutId ||
131 manager->GetCurrentInputMethod().id() == kCaMultixLayoutId;
132
129 } 133 }
130 #endif 134 #endif
131 135
132 const PrefService* GetPrefService() { 136 const PrefService* GetPrefService() {
133 Profile* profile = ProfileManager::GetDefaultProfile(); 137 Profile* profile = ProfileManager::GetDefaultProfile();
134 if (profile) 138 if (profile)
135 return profile->GetPrefs(); 139 return profile->GetPrefs();
136 return NULL; 140 return NULL;
137 } 141 }
138 142
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 const DeviceType type = EventRewriter::GetDeviceType(device_name); 1002 const DeviceType type = EventRewriter::GetDeviceType(device_name);
999 if (type == kDeviceAppleKeyboard) { 1003 if (type == kDeviceAppleKeyboard) {
1000 VLOG(1) << "Apple keyboard '" << device_name << "' connected: " 1004 VLOG(1) << "Apple keyboard '" << device_name << "' connected: "
1001 << "id=" << device_id; 1005 << "id=" << device_id;
1002 } 1006 }
1003 // Always overwrite the existing device_id since the X server may reuse a 1007 // Always overwrite the existing device_id since the X server may reuse a
1004 // device id for an unattached device. 1008 // device id for an unattached device.
1005 device_id_to_type_[device_id] = type; 1009 device_id_to_type_[device_id] = type;
1006 return type; 1010 return type;
1007 } 1011 }
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