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

Side by Side Diff: athena/wm/split_view_controller.cc

Issue 546123002: Ensure that an activity is activated when overview mode is exited (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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "athena/wm/split_view_controller.h" 5 #include "athena/wm/split_view_controller.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "athena/screen/public/screen_manager.h" 9 #include "athena/screen/public/screen_manager.h"
10 #include "athena/wm/public/window_list_provider.h" 10 #include "athena/wm/public/window_list_provider.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 bool SplitViewController::IsSplitViewModeActive() const { 59 bool SplitViewController::IsSplitViewModeActive() const {
60 return state_ == ACTIVE; 60 return state_ == ACTIVE;
61 } 61 }
62 62
63 void SplitViewController::ActivateSplitMode(aura::Window* left, 63 void SplitViewController::ActivateSplitMode(aura::Window* left,
64 aura::Window* right) { 64 aura::Window* right) {
65 aura::Window::Windows windows = window_list_provider_->GetWindowList(); 65 aura::Window::Windows windows = window_list_provider_->GetWindowList();
66 aura::Window::Windows::reverse_iterator iter = windows.rbegin(); 66 aura::Window::Windows::reverse_iterator iter = windows.rbegin();
67 if (state_ == ACTIVE) { 67 if (state_ == ACTIVE) {
68 if (left_window_ == right) 68 if (!left && left_window_ != right)
69 left_window_ = left;
70 if (right_window_ == left)
71 right_window_ = right;
72
73 if (!left)
74 left = left_window_; 69 left = left_window_;
75 if (!right) 70 if (!right && right_window_ != left)
76 right = right_window_; 71 right = right_window_;
77 } 72 }
78 73
79 if (!left && iter != windows.rend()) { 74 if (!left && iter != windows.rend()) {
80 left = *iter; 75 left = *iter;
81 iter++; 76 iter++;
82 if (left == right && iter != windows.rend()) { 77 if (left == right && iter != windows.rend()) {
83 left = *iter; 78 left = *iter;
84 iter++; 79 iter++;
85 } 80 }
86 } 81 }
87 82
88 if (!right && iter != windows.rend()) { 83 if (!right && iter != windows.rend()) {
89 right = *iter; 84 right = *iter;
90 iter++; 85 iter++;
91 if (right == left && iter != windows.rend()) { 86 if (right == left && iter != windows.rend()) {
92 right = *iter; 87 right = *iter;
93 iter++; 88 iter++;
94 } 89 }
95 } 90 }
96 91
92 to_hide_.clear();
93 if (left_window_ && left_window_ != left && left_window_ != right)
94 to_hide_.push_back(left_window_);
95 if (right_window_ && right_window_ != left && right_window_ != right)
96 to_hide_.push_back(right_window_);
97
97 SetState(ACTIVE); 98 SetState(ACTIVE);
98 right_window_ = right; 99 right_window_ = right;
99 left_window_ = left; 100 left_window_ = left;
100 UpdateLayout(true); 101 UpdateLayout(true);
101 } 102 }
102 103
103 void SplitViewController::ReplaceWindow(aura::Window* window, 104 void SplitViewController::ReplaceWindow(aura::Window* window,
104 aura::Window* replace_with) { 105 aura::Window* replace_with) {
105 CHECK(IsSplitViewModeActive()); 106 CHECK(IsSplitViewModeActive());
106 CHECK(replace_with); 107 CHECK(replace_with);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return; 149 return;
149 150
150 state_ = state; 151 state_ = state;
151 ScreenManager::Get()->SetRotationLocked(state_ != INACTIVE); 152 ScreenManager::Get()->SetRotationLocked(state_ != INACTIVE);
152 } 153 }
153 154
154 void SplitViewController::UpdateLayout(bool animate) { 155 void SplitViewController::UpdateLayout(bool animate) {
155 CHECK(left_window_); 156 CHECK(left_window_);
156 CHECK(right_window_); 157 CHECK(right_window_);
157 158
158 // Splitview can be activated from SplitViewController::ActivateSplitMode or 159 if (!animate) {
159 // SplitViewController::ScrollEnd. Additionally we don't want to rotate the 160 for (size_t i = 0; i < to_hide_.size(); ++i)
160 // screen while engaging splitview (i.e. state_ == SCROLLING). 161 to_hide_[i]->Hide();
161 if (state_ == INACTIVE && !animate) { 162 to_hide_.clear();
162 if (!wm::IsActiveWindow(left_window_)) 163
163 left_window_->Hide(); 164 if (state_ == INACTIVE) {
164 if (!wm::IsActiveWindow(right_window_)) 165 if (!wm::IsActiveWindow(left_window_))
165 right_window_->Hide(); 166 left_window_->Hide();
166 SetWindowTransforms(gfx::Transform(), gfx::Transform(), false); 167 if (!wm::IsActiveWindow(right_window_))
167 return; 168 right_window_->Hide();
169
170 SetWindowTransforms(gfx::Transform(), gfx::Transform(), false);
171 return;
172 }
168 } 173 }
169 174
170 left_window_->Show(); 175 left_window_->Show();
171 right_window_->Show(); 176 right_window_->Show();
172 window_list_provider_->MoveToFront(right_window_); 177 window_list_provider_->MoveToFront(right_window_);
173 window_list_provider_->MoveToFront(left_window_); 178 window_list_provider_->MoveToFront(left_window_);
174 179
175 if (state_ == ACTIVE) { 180 if (state_ == ACTIVE) {
176 if (animate) { 181 if (animate) {
177 gfx::Transform left_transform = GetTargetTransformForBoundsAnimation( 182 gfx::Transform left_transform = GetTargetTransformForBoundsAnimation(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 bool SplitViewController::CanScroll() { 314 bool SplitViewController::CanScroll() {
310 // TODO(mfomitchev): return false in full screen. 315 // TODO(mfomitchev): return false in full screen.
311 bool result = (!IsSplitViewModeActive() && 316 bool result = (!IsSplitViewModeActive() &&
312 window_list_provider_->GetWindowList().size() >= 2 && 317 window_list_provider_->GetWindowList().size() >= 2 &&
313 IsLandscapeOrientation(gfx::Screen::GetNativeScreen()-> 318 IsLandscapeOrientation(gfx::Screen::GetNativeScreen()->
314 GetDisplayNearestWindow(container_).rotation())); 319 GetDisplayNearestWindow(container_).rotation()));
315 return result; 320 return result;
316 } 321 }
317 322
318 } // namespace athena 323 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698