| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/magnifier_key_scroller.h" | 5 #include "ash/accelerators/magnifier_key_scroller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/accelerators/key_hold_detector.h" | 9 #include "ash/accelerators/key_hold_detector.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 return (magnifier_key_scroller_enabled || has_switch) && | 29 return (magnifier_key_scroller_enabled || has_switch) && |
| 30 ash::Shell::GetInstance()->magnification_controller()->IsEnabled(); | 30 ash::Shell::GetInstance()->magnification_controller()->IsEnabled(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 void MagnifierKeyScroller::SetEnabled(bool enabled) { | 34 void MagnifierKeyScroller::SetEnabled(bool enabled) { |
| 35 magnifier_key_scroller_enabled = enabled; | 35 magnifier_key_scroller_enabled = enabled; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // static | 38 // static |
| 39 scoped_ptr<ui::EventHandler> MagnifierKeyScroller::CreateHandler() { | 39 std::unique_ptr<ui::EventHandler> MagnifierKeyScroller::CreateHandler() { |
| 40 scoped_ptr<KeyHoldDetector::Delegate> delegate(new MagnifierKeyScroller()); | 40 std::unique_ptr<KeyHoldDetector::Delegate> delegate( |
| 41 return scoped_ptr<ui::EventHandler>(new KeyHoldDetector(std::move(delegate))); | 41 new MagnifierKeyScroller()); |
| 42 return std::unique_ptr<ui::EventHandler>( |
| 43 new KeyHoldDetector(std::move(delegate))); |
| 42 } | 44 } |
| 43 | 45 |
| 44 bool MagnifierKeyScroller::ShouldProcessEvent(const ui::KeyEvent* event) const { | 46 bool MagnifierKeyScroller::ShouldProcessEvent(const ui::KeyEvent* event) const { |
| 45 return IsEnabled() && | 47 return IsEnabled() && |
| 46 (event->key_code() == ui::VKEY_UP || | 48 (event->key_code() == ui::VKEY_UP || |
| 47 event->key_code() == ui::VKEY_DOWN || | 49 event->key_code() == ui::VKEY_DOWN || |
| 48 event->key_code() == ui::VKEY_LEFT || | 50 event->key_code() == ui::VKEY_LEFT || |
| 49 event->key_code() == ui::VKEY_RIGHT); | 51 event->key_code() == ui::VKEY_RIGHT); |
| 50 } | 52 } |
| 51 | 53 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 MagnificationController* controller = | 85 MagnificationController* controller = |
| 84 Shell::GetInstance()->magnification_controller(); | 86 Shell::GetInstance()->magnification_controller(); |
| 85 controller->SetScrollDirection(MagnificationController::SCROLL_NONE); | 87 controller->SetScrollDirection(MagnificationController::SCROLL_NONE); |
| 86 } | 88 } |
| 87 | 89 |
| 88 MagnifierKeyScroller::MagnifierKeyScroller() {} | 90 MagnifierKeyScroller::MagnifierKeyScroller() {} |
| 89 | 91 |
| 90 MagnifierKeyScroller::~MagnifierKeyScroller() {} | 92 MagnifierKeyScroller::~MagnifierKeyScroller() {} |
| 91 | 93 |
| 92 } // namespace ash | 94 } // namespace ash |
| OLD | NEW |