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

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

Issue 289583002: Lock rotation when screen is manually rotated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Define sources for rotation Created 6 years, 7 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/display/display_controller_unittest.cc » ('j') | ash/display/display_info.h » ('J')
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
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "base/command_line.h" 56 #include "base/command_line.h"
57 #include "base/metrics/user_metrics.h" 57 #include "base/metrics/user_metrics.h"
58 #include "ui/aura/env.h" 58 #include "ui/aura/env.h"
59 #include "ui/aura/window_event_dispatcher.h" 59 #include "ui/aura/window_event_dispatcher.h"
60 #include "ui/base/accelerators/accelerator.h" 60 #include "ui/base/accelerators/accelerator.h"
61 #include "ui/base/accelerators/accelerator_manager.h" 61 #include "ui/base/accelerators/accelerator_manager.h"
62 #include "ui/compositor/debug_utils.h" 62 #include "ui/compositor/debug_utils.h"
63 #include "ui/compositor/layer.h" 63 #include "ui/compositor/layer.h"
64 #include "ui/compositor/layer_animation_sequence.h" 64 #include "ui/compositor/layer_animation_sequence.h"
65 #include "ui/compositor/layer_animator.h" 65 #include "ui/compositor/layer_animator.h"
66 #include "ui/display/types/display_constants.h"
66 #include "ui/events/event.h" 67 #include "ui/events/event.h"
67 #include "ui/events/keycodes/keyboard_codes.h" 68 #include "ui/events/keycodes/keyboard_codes.h"
68 #include "ui/gfx/screen.h" 69 #include "ui/gfx/screen.h"
69 #include "ui/views/controls/webview/webview.h" 70 #include "ui/views/controls/webview/webview.h"
70 #include "ui/views/debug_utils.h" 71 #include "ui/views/debug_utils.h"
71 #include "ui/views/widget/widget.h" 72 #include "ui/views/widget/widget.h"
72 73
73 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
74 #include "ash/session/session_state_delegate.h" 75 #include "ash/session/session_state_delegate.h"
75 #include "ash/system/chromeos/keyboard_brightness_controller.h" 76 #include "ash/system/chromeos/keyboard_brightness_controller.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 339 }
339 340
340 // Rotates the screen. 341 // Rotates the screen.
341 bool HandleRotateScreen() { 342 bool HandleRotateScreen() {
342 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); 343 base::RecordAction(UserMetricsAction("Accel_Rotate_Window"));
343 gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint(); 344 gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint();
344 gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point); 345 gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point);
345 const DisplayInfo& display_info = 346 const DisplayInfo& display_info =
346 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); 347 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id());
347 Shell::GetInstance()->display_manager()->SetDisplayRotation( 348 Shell::GetInstance()->display_manager()->SetDisplayRotation(
348 display.id(), GetNextRotation(display_info.rotation())); 349 display.id(), GetNextRotation(display_info.rotation()),
350 ui::USER);
349 return true; 351 return true;
350 } 352 }
351 353
352 bool HandleScaleReset() { 354 bool HandleScaleReset() {
353 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 355 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
354 int64 display_id = display_manager->GetDisplayIdForUIScaling(); 356 int64 display_id = display_manager->GetDisplayIdForUIScaling();
355 if (display_id == gfx::Display::kInvalidDisplayID) 357 if (display_id == gfx::Display::kInvalidDisplayID)
356 return false; 358 return false;
357 359
358 base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Reset")); 360 base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Reset"));
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 keyboard_brightness_control_delegate) { 1186 keyboard_brightness_control_delegate) {
1185 keyboard_brightness_control_delegate_ = 1187 keyboard_brightness_control_delegate_ =
1186 keyboard_brightness_control_delegate.Pass(); 1188 keyboard_brightness_control_delegate.Pass();
1187 } 1189 }
1188 1190
1189 bool AcceleratorController::CanHandleAccelerators() const { 1191 bool AcceleratorController::CanHandleAccelerators() const {
1190 return true; 1192 return true;
1191 } 1193 }
1192 1194
1193 } // namespace ash 1195 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/display_controller_unittest.cc » ('j') | ash/display/display_info.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698