Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 975943002: Implemented screen rotation animation experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added ash-screen-rotation-animation entry to histograms.xml. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 10
11 #include "ash/accelerators/accelerator_commands.h" 11 #include "ash/accelerators/accelerator_commands.h"
12 #include "ash/accelerators/debug_commands.h" 12 #include "ash/accelerators/debug_commands.h"
13 #include "ash/ash_switches.h" 13 #include "ash/ash_switches.h"
14 #include "ash/debug.h" 14 #include "ash/debug.h"
15 #include "ash/display/display_controller.h" 15 #include "ash/display/display_controller.h"
16 #include "ash/display/display_manager.h" 16 #include "ash/display/display_manager.h"
17 #include "ash/display/display_util.h" 17 #include "ash/display/display_util.h"
18 #include "ash/focus_cycler.h" 18 #include "ash/focus_cycler.h"
19 #include "ash/gpu_support.h" 19 #include "ash/gpu_support.h"
20 #include "ash/ime_control_delegate.h" 20 #include "ash/ime_control_delegate.h"
21 #include "ash/magnifier/magnification_controller.h" 21 #include "ash/magnifier/magnification_controller.h"
22 #include "ash/magnifier/partial_magnification_controller.h" 22 #include "ash/magnifier/partial_magnification_controller.h"
23 #include "ash/media_delegate.h" 23 #include "ash/media_delegate.h"
24 #include "ash/multi_profile_uma.h" 24 #include "ash/multi_profile_uma.h"
25 #include "ash/new_window_delegate.h" 25 #include "ash/new_window_delegate.h"
26 #include "ash/root_window_controller.h" 26 #include "ash/root_window_controller.h"
27 #include "ash/rotator/screen_rotation.h" 27 #include "ash/rotator/screen_rotation_animator.h"
28 #include "ash/rotator/window_rotation.h"
28 #include "ash/screenshot_delegate.h" 29 #include "ash/screenshot_delegate.h"
29 #include "ash/session/session_state_delegate.h" 30 #include "ash/session/session_state_delegate.h"
30 #include "ash/shelf/shelf.h" 31 #include "ash/shelf/shelf.h"
31 #include "ash/shelf/shelf_delegate.h" 32 #include "ash/shelf/shelf_delegate.h"
32 #include "ash/shelf/shelf_model.h" 33 #include "ash/shelf/shelf_model.h"
33 #include "ash/shelf/shelf_widget.h" 34 #include "ash/shelf/shelf_widget.h"
34 #include "ash/shell.h" 35 #include "ash/shell.h"
35 #include "ash/shell_delegate.h" 36 #include "ash/shell_delegate.h"
36 #include "ash/shell_window_ids.h" 37 #include "ash/shell_window_ids.h"
37 #include "ash/system/brightness_control_delegate.h" 38 #include "ash/system/brightness_control_delegate.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return gfx::Display::ROTATE_0; 287 return gfx::Display::ROTATE_0;
287 } 288 }
288 289
289 // Rotates the screen. 290 // Rotates the screen.
290 void HandleRotateScreen() { 291 void HandleRotateScreen() {
291 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); 292 base::RecordAction(UserMetricsAction("Accel_Rotate_Window"));
292 gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint(); 293 gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint();
293 gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point); 294 gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point);
294 const DisplayInfo& display_info = 295 const DisplayInfo& display_info =
295 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); 296 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id());
296 Shell::GetInstance()->display_manager()->SetDisplayRotation( 297 ash::ScreenRotationAnimator(display.id())
297 display.id(), GetNextRotation(display_info.rotation())); 298 .Rotate(GetNextRotation(display_info.rotation()));
298 } 299 }
299 300
300 // Rotate the active window. 301 // Rotate the active window.
301 void HandleRotateActiveWindow() { 302 void HandleRotateActiveWindow() {
302 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); 303 base::RecordAction(UserMetricsAction("Accel_Rotate_Window"));
303 aura::Window* active_window = wm::GetActiveWindow(); 304 aura::Window* active_window = wm::GetActiveWindow();
304 if (active_window) { 305 if (active_window) {
305 // The rotation animation bases its target transform on the current 306 // The rotation animation bases its target transform on the current
306 // rotation and position. Since there could be an animation in progress 307 // rotation and position. Since there could be an animation in progress
307 // right now, queue this animation so when it starts it picks up a neutral 308 // right now, queue this animation so when it starts it picks up a neutral
308 // rotation and position. Use replace so we only enqueue one at a time. 309 // rotation and position. Use replace so we only enqueue one at a time.
309 active_window->layer()->GetAnimator()-> 310 active_window->layer()->GetAnimator()->
310 set_preemption_strategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); 311 set_preemption_strategy(ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
311 active_window->layer()->GetAnimator()->StartAnimation( 312 active_window->layer()->GetAnimator()->StartAnimation(
312 new ui::LayerAnimationSequence( 313 new ui::LayerAnimationSequence(
313 new ash::ScreenRotation(360, active_window->layer()))); 314 new ash::WindowRotation(360, active_window->layer())));
314 } 315 }
315 } 316 }
316 317
317 bool CanHandleScaleReset() { 318 bool CanHandleScaleReset() {
318 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 319 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
319 int64 display_id = display_manager->GetDisplayIdForUIScaling(); 320 int64 display_id = display_manager->GetDisplayIdForUIScaling();
320 return (display_id != gfx::Display::kInvalidDisplayID && 321 return (display_id != gfx::Display::kInvalidDisplayID &&
321 display_manager->GetDisplayInfo(display_id).configured_ui_scale() != 322 display_manager->GetDisplayInfo(display_id).configured_ui_scale() !=
322 1.0f); 323 1.0f);
323 } 324 }
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 } 1329 }
1329 1330
1330 void AcceleratorController::SetKeyboardBrightnessControlDelegate( 1331 void AcceleratorController::SetKeyboardBrightnessControlDelegate(
1331 scoped_ptr<KeyboardBrightnessControlDelegate> 1332 scoped_ptr<KeyboardBrightnessControlDelegate>
1332 keyboard_brightness_control_delegate) { 1333 keyboard_brightness_control_delegate) {
1333 keyboard_brightness_control_delegate_ = 1334 keyboard_brightness_control_delegate_ =
1334 keyboard_brightness_control_delegate.Pass(); 1335 keyboard_brightness_control_delegate.Pass();
1335 } 1336 }
1336 1337
1337 } // namespace ash 1338 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698