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

Unified Diff: ash/display/screen_orientation_controller_chromeos.cc

Issue 2112013002: Allow arc app to lock screen orientation in TouchView/Tablet mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit test Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/screen_orientation_controller_chromeos.cc
diff --git a/ash/display/screen_orientation_controller_chromeos.cc b/ash/display/screen_orientation_controller_chromeos.cc
index 3bbb8c55a912650a275c3d608d10efa390e24daa..4b845334b054277ddf32061d3815633ee25e0fa9 100644
--- a/ash/display/screen_orientation_controller_chromeos.cc
+++ b/ash/display/screen_orientation_controller_chromeos.cc
@@ -112,6 +112,16 @@ void ScreenOrientationController::UnlockOrientationForWindow(
ApplyLockForActiveWindow();
}
+void ScreenOrientationController::UnlockAll() {
+ for (auto pair : locking_windows_)
+ pair.first->RemoveObserver(this);
+ locking_windows_.clear();
+ Shell::GetInstance()->activation_client()->RemoveObserver(this);
+ SetRotationLocked(false);
+ if (user_rotation_ != current_rotation_)
+ SetDisplayRotation(user_rotation_, display::Display::ROTATION_SOURCE_USER);
+}
+
bool ScreenOrientationController::ScreenOrientationProviderSupported() const {
return Shell::GetInstance()
->maximize_mode_controller()
@@ -386,11 +396,13 @@ void ScreenOrientationController::LoadDisplayRotationProperties() {
void ScreenOrientationController::ApplyLockForActiveWindow() {
aura::Window* active_window =
Shell::GetInstance()->activation_client()->GetActiveWindow();
- for (auto const& windows : locking_windows_) {
- if (windows.first->TargetVisibility() &&
- active_window->Contains(windows.first)) {
- LockRotationToOrientation(windows.second);
- return;
+ if (active_window) {
+ for (auto const& windows : locking_windows_) {
+ if (windows.first->TargetVisibility() &&
+ active_window->Contains(windows.first)) {
+ LockRotationToOrientation(windows.second);
+ return;
+ }
}
}
SetRotationLocked(false);

Powered by Google App Engine
This is Rietveld 408576698