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

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: Allow arc app to lock screen orientation in TouchView/Tablet mode Created 4 years, 5 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 5c11a35fd2b568fdae6cf75c3265344281b0456c..10afdd4340d9ff6cfd80c3706442db31e95dda33 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 WmShell::Get()
->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);
« no previous file with comments | « ash/display/screen_orientation_controller_chromeos.h ('k') | chrome/browser/ui/app_list/arc/arc_app_list_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698