OLD | NEW |
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/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ui/aura/event_filter.h" | 9 #include "ui/aura/event_filter.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 //////////////////////////////////////////////////////////////////////////////// | 429 //////////////////////////////////////////////////////////////////////////////// |
430 // MagnificationControllerImpl: aura::EventFilter implementation | 430 // MagnificationControllerImpl: aura::EventFilter implementation |
431 | 431 |
432 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target, | 432 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target, |
433 ui::KeyEvent* event) { | 433 ui::KeyEvent* event) { |
434 return false; | 434 return false; |
435 } | 435 } |
436 | 436 |
437 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, | 437 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, |
438 ui::MouseEvent* event) { | 438 ui::MouseEvent* event) { |
439 if (event->type() == ui::ET_SCROLL && event->IsAltDown()) { | 439 if (event->type() == ui::ET_SCROLL && |
| 440 event->IsAltDown() & |
| 441 event->IsControlDown()) { |
440 ui::ScrollEvent* scroll_event = static_cast<ui::ScrollEvent*>(event); | 442 ui::ScrollEvent* scroll_event = static_cast<ui::ScrollEvent*>(event); |
441 float scale = GetScale(); | 443 float scale = GetScale(); |
442 scale += scroll_event->y_offset() * kScrollScaleChangeFactor; | 444 scale += scroll_event->y_offset() * kScrollScaleChangeFactor; |
443 SetScale(scale, true); | 445 SetScale(scale, true); |
444 return true; | 446 return true; |
445 } | 447 } |
446 | 448 |
447 if (IsMagnified() && event->type() == ui::ET_MOUSE_MOVED) { | 449 if (IsMagnified() && event->type() == ui::ET_MOUSE_MOVED) { |
448 aura::RootWindow* current_root = target->GetRootWindow(); | 450 aura::RootWindow* current_root = target->GetRootWindow(); |
449 gfx::Rect root_bounds = current_root->bounds(); | 451 gfx::Rect root_bounds = current_root->bounds(); |
(...skipping 24 matching lines...) Expand all Loading... |
474 //////////////////////////////////////////////////////////////////////////////// | 476 //////////////////////////////////////////////////////////////////////////////// |
475 // MagnificationController: | 477 // MagnificationController: |
476 | 478 |
477 // static | 479 // static |
478 MagnificationController* MagnificationController::CreateInstance() { | 480 MagnificationController* MagnificationController::CreateInstance() { |
479 return new MagnificationControllerImpl(); | 481 return new MagnificationControllerImpl(); |
480 } | 482 } |
481 | 483 |
482 } // namespace internal | 484 } // namespace internal |
483 } // namespace ash | 485 } // namespace ash |
OLD | NEW |