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

Unified Diff: ash/system/chromeos/screen_orientation/screen_orientation_delegate_ash.cc

Issue 648733003: Implement ScreenOrientationDelegate on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/system/chromeos/screen_orientation/screen_orientation_delegate_ash.cc
diff --git a/ash/system/chromeos/screen_orientation/screen_orientation_delegate_ash.cc b/ash/system/chromeos/screen_orientation/screen_orientation_delegate_ash.cc
new file mode 100644
index 0000000000000000000000000000000000000000..15e4c37bff43dddde99ea2d7abbf7cd81f520309
--- /dev/null
+++ b/ash/system/chromeos/screen_orientation/screen_orientation_delegate_ash.cc
@@ -0,0 +1,65 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/system/chromeos/screen_orientation/screen_orientation_delegate_ash.h"
+
+#include "ash/shell.h"
+#include "ash/wm/maximize_mode/maximize_mode_controller.h"
+#include "content/public/browser/screen_orientation_provider.h"
+#include "ui/gfx/display.h"
+
+namespace ash {
+
+ScreenOrientationDelegateAsh::ScreenOrientationDelegateAsh() {
+ content::ScreenOrientationProvider::SetDelegate(this);
+}
+
+ScreenOrientationDelegateAsh::~ScreenOrientationDelegateAsh() {
+ content::ScreenOrientationProvider::SetDelegate(NULL);
+}
+
+bool ScreenOrientationDelegateAsh::FullScreenRequired(
+ content::WebContents* web_contents) {
+ return true;
+}
+
+void ScreenOrientationDelegateAsh::Lock(
+ blink::WebScreenOrientationLockType lock_orientation) {
+ MaximizeModeController* controller =
+ Shell::GetInstance()->maximize_mode_controller();
+ switch (lock_orientation) {
+ case blink::WebScreenOrientationLockDefault:
+ controller->SetRotationLocked(false);
mlamouri (slow - plz ping) 2014/10/13 09:45:44 Why not, but technically, that should not happen.
jonross 2014/10/14 19:38:04 Done.
+ break;
+ case blink::WebScreenOrientationLockPortraitPrimary:
+ case blink::WebScreenOrientationLockPortrait:
+ controller->LockRotation(gfx::Display::ROTATE_90);
mlamouri (slow - plz ping) 2014/10/13 09:45:44 Two things worry me here: 1. we should allow rotat
jonross 2014/10/14 14:46:57 1) Had not realized that. The ChromeOS user rotati
jonross 2014/10/14 19:38:04 Done.
+ break;
+ case blink::WebScreenOrientationLockPortraitSecondary:
+ controller->LockRotation(gfx::Display::ROTATE_270);
+ case blink::WebScreenOrientationLockLandscapeSecondary:
+ controller->LockRotation(gfx::Display::ROTATE_180);
mlamouri (slow - plz ping) 2014/10/13 09:45:44 Same regarding the natural orientation for the 'po
+ break;
+ case blink::WebScreenOrientationLockAny:
+ controller->SetRotationLocked(true);
mlamouri (slow - plz ping) 2014/10/13 09:45:44 'any' doesn't mean locked to the current orientati
jonross 2014/10/14 19:38:04 Correct it is unlocked. Merging with the DCHEcK fo
+ break;
+ case blink::WebScreenOrientationLockLandscapePrimary:
+ case blink::WebScreenOrientationLockLandscape:
+ case blink::WebScreenOrientationLockNatural:
+ default:
+ controller->LockRotation(gfx::Display::ROTATE_0);
mlamouri (slow - plz ping) 2014/10/13 09:45:44 Same comment regarding the natural orientation.
jonross 2014/10/14 19:38:04 Done.
+ break;
+ }
+}
+
+bool ScreenOrientationDelegateAsh::ScreenOrientationProviderSupported() {
+ return Shell::GetInstance()->maximize_mode_controller()->
+ IsMaximizeModeWindowManagerEnabled();
+}
+
+void ScreenOrientationDelegateAsh::Unlock() {
+ Shell::GetInstance()->maximize_mode_controller()->SetRotationLocked(false);
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698