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

Unified Diff: athena/wm/split_view_controller.cc

Issue 535973002: Disable screen rotation when splitview is engaged and only allow splitview in landscape. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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: athena/wm/split_view_controller.cc
diff --git a/athena/wm/split_view_controller.cc b/athena/wm/split_view_controller.cc
index 3c019d4608d98794a569a8f9e0a8d7d7a6f28898..43984d7389051b6d35945226d7c9b7bf40bc04f1 100644
--- a/athena/wm/split_view_controller.cc
+++ b/athena/wm/split_view_controller.cc
@@ -6,6 +6,7 @@
#include <cmath>
+#include "athena/screen/public/screen_manager.h"
#include "athena/wm/public/window_list_provider.h"
#include "athena/wm/public/window_manager.h"
#include "base/bind.h"
@@ -33,6 +34,11 @@ gfx::Transform GetTargetTransformForBoundsAnimation(const gfx::Rect& from,
return transform;
}
+bool IsLandscapeOrientation(gfx::Display::Rotation rotation) {
+ return rotation == gfx::Display::ROTATE_0 ||
+ rotation == gfx::Display::ROTATE_180;
+}
+
} // namespace
SplitViewController::SplitViewController(
@@ -127,6 +133,7 @@ void SplitViewController::DeactivateSplitMode() {
state_ = INACTIVE;
UpdateLayout(false);
left_window_ = right_window_ = NULL;
+ ScreenManager::Get()->SetRotationLocked(false);
}
gfx::Rect SplitViewController::GetLeftTargetBounds() {
@@ -147,6 +154,10 @@ void SplitViewController::UpdateLayout(bool animate) {
CHECK(left_window_);
CHECK(right_window_);
+ // Splitview can be activated from SplitViewController::ActivateSplitMode or
+ // SplitViewController::ScrollEnd. Additionally we don't want to rotate the
+ // screen while engaging splitview (i.e. state_ == SCROLLING).
+ ScreenManager::Get()->SetRotationLocked(state_ != INACTIVE);
mfomitchev 2014/09/03 15:33:59 Perhaps we should create a SetState() method and l
flackr 2014/09/03 16:42:13 Done.
if (state_ == INACTIVE && !animate) {
if (!wm::IsActiveWindow(left_window_))
left_window_->Hide();
@@ -293,9 +304,11 @@ void SplitViewController::ScrollUpdate(float delta) {
}
bool SplitViewController::CanScroll() {
- // TODO(mfomitchev): return false in vertical orientation, in full screen.
+ // TODO(mfomitchev): return false in full screen.
bool result = (!IsSplitViewModeActive() &&
- window_list_provider_->GetWindowList().size() >= 2);
+ window_list_provider_->GetWindowList().size() >= 2 &&
+ IsLandscapeOrientation(gfx::Screen::GetNativeScreen()->
+ GetDisplayNearestWindow(container_).rotation()));
return result;
}

Powered by Google App Engine
This is Rietveld 408576698