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/wm/gestures/bezel_gesture_handler.h" | 5 #include "ash/wm/gestures/bezel_gesture_handler.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/launcher/launcher.h" | 10 #include "ash/launcher/launcher.h" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 bool BezelGestureHandler::HandleLauncherControl(const ui::GestureEvent& event) { | 133 bool BezelGestureHandler::HandleLauncherControl(const ui::GestureEvent& event) { |
134 CHECK_EQ(BEZEL_START_BOTTOM, start_location_); | 134 CHECK_EQ(BEZEL_START_BOTTOM, start_location_); |
135 shelf_handler_.ProcessGestureEvent(event); | 135 shelf_handler_.ProcessGestureEvent(event); |
136 return event.type() == ui::ET_GESTURE_SCROLL_END || | 136 return event.type() == ui::ET_GESTURE_SCROLL_END || |
137 event.type() == ui::ET_SCROLL_FLING_START; | 137 event.type() == ui::ET_SCROLL_FLING_START; |
138 } | 138 } |
139 | 139 |
140 bool BezelGestureHandler::HandleApplicationControl( | 140 bool BezelGestureHandler::HandleApplicationControl( |
141 const ui::GestureEvent& event) { | 141 const ui::GestureEvent& event) { |
142 ash::AcceleratorController* accelerator = | |
143 ash::Shell::GetInstance()->accelerator_controller(); | |
144 if (start_location_ == BEZEL_START_LEFT && event.details().scroll_x() > 0) { | 142 if (start_location_ == BEZEL_START_LEFT && event.details().scroll_x() > 0) { |
145 accelerator->PerformAction(CYCLE_BACKWARD_LINEAR, ui::Accelerator()); | 143 Launcher::ForPrimaryDisplay()->CycleWindowLinear(CYCLE_BACKWARD); |
146 } else if (start_location_ == BEZEL_START_RIGHT && | 144 } else if (start_location_ == BEZEL_START_RIGHT && |
147 event.details().scroll_x() < 0) { | 145 event.details().scroll_x() < 0) { |
148 accelerator->PerformAction(CYCLE_FORWARD_LINEAR, ui::Accelerator()); | 146 Launcher::ForPrimaryDisplay()->CycleWindowLinear(CYCLE_FORWARD); |
149 } else { | 147 } else { |
150 return false; | 148 return false; |
151 } | 149 } |
152 | 150 |
153 // No further notifications for this gesture. | 151 // No further notifications for this gesture. |
154 return true; | 152 return true; |
155 } | 153 } |
156 | 154 |
157 void BezelGestureHandler::HandleBezelGestureStart( | 155 void BezelGestureHandler::HandleBezelGestureStart( |
158 aura::Window* target, | 156 aura::Window* target, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // Turning off the display makes no sense, so we map the accessible range to | 281 // Turning off the display makes no sense, so we map the accessible range to |
284 // kMinimumBrightness .. 100%. | 282 // kMinimumBrightness .. 100%. |
285 percent = (percent + kMinBrightnessPercent) * 100.0 / | 283 percent = (percent + kMinBrightnessPercent) * 100.0 / |
286 (100.0 + kMinBrightnessPercent); | 284 (100.0 + kMinBrightnessPercent); |
287 // Clamp to avoid rounding issues. | 285 // Clamp to avoid rounding issues. |
288 return std::min(percent, 100.0); | 286 return std::min(percent, 100.0); |
289 } | 287 } |
290 | 288 |
291 } // namespace internal | 289 } // namespace internal |
292 } // namespace ash | 290 } // namespace ash |
OLD | NEW |