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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return false; | 153 return false; |
154 } | 154 } |
155 | 155 |
156 // No further notifications for this gesture. | 156 // No further notifications for this gesture. |
157 return true; | 157 return true; |
158 } | 158 } |
159 | 159 |
160 void BezelGestureHandler::HandleBezelGestureStart( | 160 void BezelGestureHandler::HandleBezelGestureStart( |
161 aura::Window* target, | 161 aura::Window* target, |
162 const ui::GestureEvent& event) { | 162 const ui::GestureEvent& event) { |
163 gfx::Rect screen = gfx::Screen::GetDisplayNearestWindow(target).bounds(); | 163 gfx::Rect screen = |
| 164 Shell::GetScreen()->GetDisplayNearestWindow(target).bounds(); |
164 int overlap_area = screen.width() * overlap_percent_ / 100; | 165 int overlap_area = screen.width() * overlap_percent_ / 100; |
165 orientation_ = SCROLL_ORIENTATION_UNSET; | 166 orientation_ = SCROLL_ORIENTATION_UNSET; |
166 | 167 |
167 if (event.x() <= screen.x() + overlap_area) { | 168 if (event.x() <= screen.x() + overlap_area) { |
168 start_location_ = BEZEL_START_LEFT; | 169 start_location_ = BEZEL_START_LEFT; |
169 } else if (event.x() >= screen.right() - overlap_area) { | 170 } else if (event.x() >= screen.right() - overlap_area) { |
170 start_location_ = BEZEL_START_RIGHT; | 171 start_location_ = BEZEL_START_RIGHT; |
171 } else if (event.y() >= screen.bottom()) { | 172 } else if (event.y() >= screen.bottom()) { |
172 start_location_ = BEZEL_START_BOTTOM; | 173 start_location_ = BEZEL_START_BOTTOM; |
173 } | 174 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 } else { | 208 } else { |
208 if (start_location_ == BEZEL_START_BOTTOM) { | 209 if (start_location_ == BEZEL_START_BOTTOM) { |
209 if (HandleLauncherControl(event)) | 210 if (HandleLauncherControl(event)) |
210 start_location_ = BEZEL_START_UNSET; | 211 start_location_ = BEZEL_START_UNSET; |
211 } else { | 212 } else { |
212 // Check if device gestures should be performed or not. | 213 // Check if device gestures should be performed or not. |
213 if (!enable_bezel_device_control_) { | 214 if (!enable_bezel_device_control_) { |
214 start_location_ = BEZEL_START_UNSET; | 215 start_location_ = BEZEL_START_UNSET; |
215 return; | 216 return; |
216 } | 217 } |
217 gfx::Rect screen = gfx::Screen::GetDisplayNearestWindow(target).bounds(); | 218 gfx::Rect screen = |
| 219 Shell::GetScreen()->GetDisplayNearestWindow(target).bounds(); |
218 // Limit the user gesture "mostly" to the off screen area and check for | 220 // Limit the user gesture "mostly" to the off screen area and check for |
219 // noise invocation. | 221 // noise invocation. |
220 if (!GestureInBezelArea(screen, event) || | 222 if (!GestureInBezelArea(screen, event) || |
221 BezelGestureMightBeNoise(screen, event)) | 223 BezelGestureMightBeNoise(screen, event)) |
222 return; | 224 return; |
223 if (HandleDeviceControl(screen, event)) | 225 if (HandleDeviceControl(screen, event)) |
224 start_location_ = BEZEL_START_UNSET; | 226 start_location_ = BEZEL_START_UNSET; |
225 } | 227 } |
226 } | 228 } |
227 } | 229 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // Turning off the display makes no sense, so we map the accessible range to | 286 // Turning off the display makes no sense, so we map the accessible range to |
285 // kMinimumBrightness .. 100%. | 287 // kMinimumBrightness .. 100%. |
286 percent = (percent + kMinBrightnessPercent) * 100.0 / | 288 percent = (percent + kMinBrightnessPercent) * 100.0 / |
287 (100.0 + kMinBrightnessPercent); | 289 (100.0 + kMinBrightnessPercent); |
288 // Clamp to avoid rounding issues. | 290 // Clamp to avoid rounding issues. |
289 return std::min(percent, 100.0); | 291 return std::min(percent, 100.0); |
290 } | 292 } |
291 | 293 |
292 } // namespace internal | 294 } // namespace internal |
293 } // namespace ash | 295 } // namespace ash |
OLD | NEW |