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

Unified Diff: athena/wm/split_view_controller.cc

Issue 472963002: athena: Add a test for split-view controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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
« no previous file with comments | « athena/wm/split_view_controller.h ('k') | athena/wm/split_view_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/wm/split_view_controller.cc
diff --git a/athena/wm/split_view_controller.cc b/athena/wm/split_view_controller.cc
index 9e8984a30c6065f7ab1ba4aa1fc60575ec4458e7..997c107e244179dbfac1f83da353a4f3bd6c1fad 100644
--- a/athena/wm/split_view_controller.cc
+++ b/athena/wm/split_view_controller.cc
@@ -32,11 +32,13 @@ SplitViewController::SplitViewController(
right_window_(NULL),
separator_position_(0),
weak_factory_(this) {
- window_manager->AddObserver(this);
+ if (window_manager_)
+ window_manager_->AddObserver(this);
}
SplitViewController::~SplitViewController() {
- window_manager_->RemoveObserver(this);
+ if (window_manager_)
+ window_manager_->RemoveObserver(this);
}
bool SplitViewController::IsSplitViewModeActive() const {
@@ -48,6 +50,11 @@ void SplitViewController::ActivateSplitMode(aura::Window* left,
aura::Window::Windows windows = window_list_provider_->GetWindowList();
aura::Window::Windows::reverse_iterator iter = windows.rbegin();
if (state_ == ACTIVE) {
+ if (left_window_ == right)
+ left_window_ = left;
+ if (right_window_ == left)
+ right_window_ = right;
+
if (!left)
left = left_window_;
if (!right)
@@ -73,10 +80,14 @@ void SplitViewController::ActivateSplitMode(aura::Window* left,
}
state_ = ACTIVE;
- left_window_ = left;
- right_window_ = right;
- container_->StackChildAtTop(right_window_);
- container_->StackChildAtTop(left_window_);
+ if (right_window_ != right) {
+ right_window_ = right;
+ container_->StackChildAtTop(right_window_);
+ }
+ if (left_window_ != left) {
+ left_window_ = left;
+ container_->StackChildAtTop(left_window_);
+ }
UpdateLayout(true);
}
@@ -256,7 +267,7 @@ void SplitViewController::ScrollUpdate(float delta) {
bool SplitViewController::CanScroll() {
// TODO(mfomitchev): return false in vertical orientation, in full screen.
- bool result = (!window_manager_->IsOverviewModeActive() &&
+ bool result = (window_manager_ && !window_manager_->IsOverviewModeActive() &&
!IsSplitViewModeActive() &&
window_list_provider_->GetWindowList().size() >= 2);
return result;
« no previous file with comments | « athena/wm/split_view_controller.h ('k') | athena/wm/split_view_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698