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

Side by Side Diff: ash/display/screen_orientation_controller_chromeos.cc

Issue 2951773002: Don't lock and save the orientation change made not through ScreenOrientationController (Closed)
Patch Set: removed tests that no longer makes sense Created 3 years, 6 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 | « ash/display/display_manager_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/display/screen_orientation_controller_chromeos.h" 5 #include "ash/display/screen_orientation_controller_chromeos.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/display/display_configuration_controller.h" 8 #include "ash/display/display_configuration_controller.h"
9 #include "ash/shared/app_types.h" 9 #include "ash/shared/app_types.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 chromeos::ACCELEROMETER_SOURCE_SCREEN)) { 281 chromeos::ACCELEROMETER_SOURCE_SCREEN)) {
282 HandleScreenRotation(update->get(chromeos::ACCELEROMETER_SOURCE_SCREEN)); 282 HandleScreenRotation(update->get(chromeos::ACCELEROMETER_SOURCE_SCREEN));
283 } 283 }
284 } 284 }
285 285
286 void ScreenOrientationController::OnDisplayConfigurationChanged() { 286 void ScreenOrientationController::OnDisplayConfigurationChanged() {
287 if (ignore_display_configuration_updates_) 287 if (ignore_display_configuration_updates_)
288 return; 288 return;
289 if (!display::Display::HasInternalDisplay()) 289 if (!display::Display::HasInternalDisplay())
290 return; 290 return;
291 display::Display::Rotation user_rotation = 291 if (!Shell::Get()->display_manager()->IsActiveDisplayId(
292 display::Display::InternalDisplayId())) {
293 return;
294 }
295
296 // TODO(oshima): We should disable the orientation change in settings
297 // because application may not work correctly.
298 current_rotation_ =
292 ShellPort::Get() 299 ShellPort::Get()
293 ->GetDisplayInfo(display::Display::InternalDisplayId()) 300 ->GetDisplayInfo(display::Display::InternalDisplayId())
294 .GetActiveRotation(); 301 .GetActiveRotation();
295 if (user_rotation != current_rotation_) {
296 // TODO(oshima): We should disable the orientation change in settings
297 // because application may not work correctly.
298
299 // A user may change other display configuration settings. When the user
300 // does change the rotation setting, then lock rotation to prevent the
301 // accelerometer from erasing their change.
302 SetRotationLockedInternal(true);
303 user_rotation_ = current_rotation_ = user_rotation;
304 }
305 } 302 }
306 303
307 void ScreenOrientationController::OnMaximizeModeStarted() { 304 void ScreenOrientationController::OnMaximizeModeStarted() {
308 // Do not exit early, as the internal display can be determined after Maximize 305 // Do not exit early, as the internal display can be determined after Maximize
309 // Mode has started. (chrome-os-partner:38796) 306 // Mode has started. (chrome-os-partner:38796)
310 // Always start observing. 307 // Always start observing.
311 if (display::Display::HasInternalDisplay()) { 308 if (display::Display::HasInternalDisplay()) {
312 current_rotation_ = user_rotation_ = 309 current_rotation_ = user_rotation_ =
313 ShellPort::Get() 310 ShellPort::Get()
314 ->GetDisplayInfo(display::Display::InternalDisplayId()) 311 ->GetDisplayInfo(display::Display::InternalDisplayId())
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 } 576 }
580 577
581 bool ScreenOrientationController::CanRotateInLockedState() { 578 bool ScreenOrientationController::CanRotateInLockedState() {
582 return rotation_locked_orientation_ == 579 return rotation_locked_orientation_ ==
583 blink::kWebScreenOrientationLockLandscape || 580 blink::kWebScreenOrientationLockLandscape ||
584 rotation_locked_orientation_ == 581 rotation_locked_orientation_ ==
585 blink::kWebScreenOrientationLockPortrait; 582 blink::kWebScreenOrientationLockPortrait;
586 } 583 }
587 584
588 } // namespace ash 585 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698