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; |
} |