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 "ash/accelerators/key_hold_detector.h" | 7 #include "ash/accelerators/key_hold_detector.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/magnifier/magnification_controller.h" | 9 #include "ash/magnifier/magnification_controller.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 namespace { | 14 namespace { |
15 bool magnifier_key_scroller_enabled = false; | 15 bool magnifier_key_scroller_enabled = false; |
16 } | 16 } |
17 | 17 |
18 // static | 18 // static |
19 bool MagnifierKeyScroller::IsEnabled() { | 19 bool MagnifierKeyScroller::IsEnabled() { |
20 bool has_switch = false; | 20 return (magnifier_key_scroller_enabled || |
21 #if defined(OS_CHROMEOS) | 21 CommandLine::ForCurrentProcess()->HasSwitch( |
22 has_switch = CommandLine::ForCurrentProcess()->HasSwitch( | 22 switches::kAshEnableMagnifierKeyScroller)) && |
23 switches::kAshEnableMagnifierKeyScroller); | |
24 #endif | |
25 | |
26 return (magnifier_key_scroller_enabled || has_switch) && | |
27 ash::Shell::GetInstance()->magnification_controller()->IsEnabled(); | 23 ash::Shell::GetInstance()->magnification_controller()->IsEnabled(); |
28 } | 24 } |
29 | 25 |
30 // static | 26 // static |
31 void MagnifierKeyScroller::SetEnabled(bool enabled) { | 27 void MagnifierKeyScroller::SetEnabled(bool enabled) { |
32 magnifier_key_scroller_enabled = enabled; | 28 magnifier_key_scroller_enabled = enabled; |
33 } | 29 } |
34 | 30 |
35 // static | 31 // static |
36 scoped_ptr<ui::EventHandler> MagnifierKeyScroller::CreateHandler() { | 32 scoped_ptr<ui::EventHandler> MagnifierKeyScroller::CreateHandler() { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 MagnificationController* controller = | 72 MagnificationController* controller = |
77 Shell::GetInstance()->magnification_controller(); | 73 Shell::GetInstance()->magnification_controller(); |
78 controller->SetScrollDirection(MagnificationController::SCROLL_NONE); | 74 controller->SetScrollDirection(MagnificationController::SCROLL_NONE); |
79 } | 75 } |
80 | 76 |
81 MagnifierKeyScroller::MagnifierKeyScroller() {} | 77 MagnifierKeyScroller::MagnifierKeyScroller() {} |
82 | 78 |
83 MagnifierKeyScroller::~MagnifierKeyScroller() {} | 79 MagnifierKeyScroller::~MagnifierKeyScroller() {} |
84 | 80 |
85 } // namespace ash | 81 } // namespace ash |
OLD | NEW |