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

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 10452042: Fixing french keyboard handling (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 7 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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include "ash/accelerators/accelerator_table.h" 7 #include "ash/accelerators/accelerator_table.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/caps_lock_delegate.h" 9 #include "ash/caps_lock_delegate.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void AcceleratorController::Unregister(const ui::Accelerator& accelerator, 235 void AcceleratorController::Unregister(const ui::Accelerator& accelerator,
236 ui::AcceleratorTarget* target) { 236 ui::AcceleratorTarget* target) {
237 accelerator_manager_->Unregister(accelerator, target); 237 accelerator_manager_->Unregister(accelerator, target);
238 } 238 }
239 239
240 void AcceleratorController::UnregisterAll(ui::AcceleratorTarget* target) { 240 void AcceleratorController::UnregisterAll(ui::AcceleratorTarget* target) {
241 accelerator_manager_->UnregisterAll(target); 241 accelerator_manager_->UnregisterAll(target);
242 } 242 }
243 243
244 bool AcceleratorController::Process(const ui::Accelerator& accelerator) { 244 bool AcceleratorController::Process(const ui::Accelerator& accelerator) {
245 // On French keyboards the user needs to press a number key in conjunction
246 // with the shift key. To get the right accelerator from our static table
247 // we modify the received accelerator to match this.
248 if (accelerator.key_code() >= ui::VKEY_0 &&
mazda 2012/05/25 22:52:38 I'm worried about letting AcceleratorController ha
Mr4D (OOO till 08-26) 2012/05/29 14:59:25 Done
249 accelerator.key_code() <= ui::VKEY_9) {
250 // A keyboard layout can get changed by the user, so we need to dynamically
251 // check if a modification is required.
252 if (ime_control_delegate_.get() &&
253 ime_control_delegate_->IsFrenchKeyboard()) {
254 // We toggle the shift key to get the correct accelerator from our table.
255 return accelerator_manager_->Process(
256 ui::Accelerator(accelerator.key_code(),
257 accelerator.modifiers() ^ ui::EF_SHIFT_DOWN));
258 }
259 }
245 return accelerator_manager_->Process(accelerator); 260 return accelerator_manager_->Process(accelerator);
246 } 261 }
247 262
248 bool AcceleratorController::IsRegistered( 263 bool AcceleratorController::IsRegistered(
249 const ui::Accelerator& accelerator) const { 264 const ui::Accelerator& accelerator) const {
250 return accelerator_manager_->GetCurrentTarget(accelerator) != NULL; 265 return accelerator_manager_->GetCurrentTarget(accelerator) != NULL;
251 } 266 }
252 267
253 void AcceleratorController::SetBrightnessControlDelegate( 268 void AcceleratorController::SetBrightnessControlDelegate(
254 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) { 269 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // Then set this one as active. 549 // Then set this one as active.
535 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); 550 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index);
536 } 551 }
537 } 552 }
538 553
539 bool AcceleratorController::CanHandleAccelerators() const { 554 bool AcceleratorController::CanHandleAccelerators() const {
540 return true; 555 return true;
541 } 556 }
542 557
543 } // namespace ash 558 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.cc » ('j') | chrome/browser/ui/views/ash/ime_controller_chromeos.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698