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

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

Issue 545393002: Adding split view divider widget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format 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"
11 #include "athena/wm/public/window_manager.h" 11 #include "athena/wm/public/window_manager.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
14 #include "ui/compositor/closure_animation_observer.h" 14 #include "ui/compositor/closure_animation_observer.h"
15 #include "ui/compositor/layer_animation_observer.h"
16 #include "ui/compositor/scoped_layer_animation_settings.h" 15 #include "ui/compositor/scoped_layer_animation_settings.h"
17 #include "ui/events/event_handler.h" 16 #include "ui/events/event_handler.h"
18 #include "ui/gfx/display.h" 17 #include "ui/gfx/display.h"
19 #include "ui/gfx/screen.h" 18 #include "ui/gfx/screen.h"
20 #include "ui/wm/core/window_util.h" 19 #include "ui/wm/core/window_util.h"
21 20
22 namespace athena { 21 namespace athena {
23 22
24 namespace { 23 namespace {
25 24
26 // Returns a target transform which is suitable for animating a windows's 25 // Returns a target transform required to transform |from| to |to|.
27 // bounds. 26 gfx::Transform GetTransformForBounds(const gfx::Rect& from,
28 gfx::Transform GetTargetTransformForBoundsAnimation(const gfx::Rect& from, 27 const gfx::Rect& to) {
29 const gfx::Rect& to) {
30 gfx::Transform transform; 28 gfx::Transform transform;
31 transform.Translate(to.x() - from.x(), to.y() - from.y()); 29 transform.Translate(to.x() - from.x(), to.y() - from.y());
32 transform.Scale(to.width() / static_cast<float>(from.width()), 30 transform.Scale(to.width() / static_cast<float>(from.width()),
33 to.height() / static_cast<float>(from.height())); 31 to.height() / static_cast<float>(from.height()));
34 return transform; 32 return transform;
35 } 33 }
36 34
37 bool IsLandscapeOrientation(gfx::Display::Rotation rotation) { 35 bool IsLandscapeOrientation(gfx::Display::Rotation rotation) {
38 return rotation == gfx::Display::ROTATE_0 || 36 return rotation == gfx::Display::ROTATE_0 ||
39 rotation == gfx::Display::ROTATE_180; 37 rotation == gfx::Display::ROTATE_180;
40 } 38 }
41 39
42 } // namespace 40 } // namespace
43 41
44 SplitViewController::SplitViewController( 42 SplitViewController::SplitViewController(
45 aura::Window* container, 43 aura::Window* container,
46 WindowListProvider* window_list_provider) 44 WindowListProvider* window_list_provider)
47 : state_(INACTIVE), 45 : state_(INACTIVE),
48 container_(container), 46 container_(container),
49 window_list_provider_(window_list_provider), 47 window_list_provider_(window_list_provider),
50 left_window_(NULL), 48 left_window_(NULL),
51 right_window_(NULL), 49 right_window_(NULL),
52 separator_position_(0), 50 divider_position_(0),
53 weak_factory_(this) { 51 weak_factory_(this) {
54 } 52 }
55 53
56 SplitViewController::~SplitViewController() { 54 SplitViewController::~SplitViewController() {
57 } 55 }
58 56
59 bool SplitViewController::IsSplitViewModeActive() const { 57 bool SplitViewController::IsSplitViewModeActive() const {
60 return state_ == ACTIVE; 58 return state_ == ACTIVE;
61 } 59 }
62 60
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 94
97 SetState(ACTIVE); 95 SetState(ACTIVE);
98 if (right_window_ != right) { 96 if (right_window_ != right) {
99 right_window_ = right; 97 right_window_ = right;
100 container_->StackChildAtTop(right_window_); 98 container_->StackChildAtTop(right_window_);
101 } 99 }
102 if (left_window_ != left) { 100 if (left_window_ != left) {
103 left_window_ = left; 101 left_window_ = left;
104 container_->StackChildAtTop(left_window_); 102 container_->StackChildAtTop(left_window_);
105 } 103 }
104 if (!divider_widget_) {
105 divider_widget_.reset(CreateDividerWidget());
106 divider_widget_->Show();
107 }
108
sadrul 2014/09/12 04:30:36 Show() should be outside of the if?
mfomitchev 2014/09/12 20:49:07 I changed the code so that Show/Hid is only done f
106 UpdateLayout(true); 109 UpdateLayout(true);
107 } 110 }
108 111
109 void SplitViewController::ReplaceWindow(aura::Window* window, 112 void SplitViewController::ReplaceWindow(aura::Window* window,
110 aura::Window* replace_with) { 113 aura::Window* replace_with) {
111 CHECK(IsSplitViewModeActive()); 114 CHECK(IsSplitViewModeActive());
112 CHECK(replace_with); 115 CHECK(replace_with);
113 CHECK(window == left_window_ || window == right_window_); 116 CHECK(window == left_window_ || window == right_window_);
114 CHECK(replace_with != left_window_ && replace_with != right_window_); 117 CHECK(replace_with != left_window_ && replace_with != right_window_);
115 #if !defined(NDEBUG) 118 #if !defined(NDEBUG)
(...skipping 10 matching lines...) Expand all
126 UpdateLayout(false); 129 UpdateLayout(false);
127 window->SetTransform(gfx::Transform()); 130 window->SetTransform(gfx::Transform());
128 window->Hide(); 131 window->Hide();
129 } 132 }
130 133
131 void SplitViewController::DeactivateSplitMode() { 134 void SplitViewController::DeactivateSplitMode() {
132 CHECK_EQ(ACTIVE, state_); 135 CHECK_EQ(ACTIVE, state_);
133 SetState(INACTIVE); 136 SetState(INACTIVE);
134 UpdateLayout(false); 137 UpdateLayout(false);
135 left_window_ = right_window_ = NULL; 138 left_window_ = right_window_ = NULL;
139 CHECK(divider_widget_);
140 divider_widget_.reset();
136 } 141 }
137 142
138 gfx::Rect SplitViewController::GetLeftTargetBounds() { 143 const int kDragHandleWidth = 4;
144 const int kDragHandleHeight = 80;
145 const int kDragHandleInnerMargin = 2;
146 const int kDividerWidth = kDragHandleWidth + 2 * kDragHandleInnerMargin;
Jun Mukai 2014/09/08 19:32:00 These const values should be in the anonymous name
mfomitchev 2014/09/12 19:58:42 Done.
147
148 views::Widget* SplitViewController::CreateDividerWidget() {
149 views::View* divider_view = CreateDragHandleView(DragHandle::HORIZONTAL,
150 this,
151 kDragHandleWidth,
152 kDragHandleHeight,
153 kDragHandleInnerMargin);
154 views::Widget* widget = new views::Widget();
155 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
156 params.parent = container_;
157 params.accept_events = true;
158 params.activatable = views::Widget::InitParams::ACTIVATABLE_YES;
159 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
160 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
161 widget->Init(params);
162 widget->SetContentsView(divider_view);
163 const gfx::Size& size =
164 gfx::Size(kDividerWidth, container_->bounds().height());
sadrul 2014/09/12 04:30:36 The minimized home-card allows swiping anywhere (i
mfomitchev 2014/09/12 20:49:07 I was trying to minimize the height of the widget,
165 widget->SetSize(size);
Jun Mukai 2014/09/08 19:32:00 why not simply SetSize(gfx::Size(...))? Also, use
mfomitchev 2014/09/12 19:58:42 Done. There's no intial_bounds, I just used bounds
166
167 return widget;
168 }
169
170 gfx::Rect SplitViewController::GetLeftAreaBounds() {
139 gfx::Rect work_area = 171 gfx::Rect work_area =
140 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area(); 172 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area();
141 return gfx::Rect(0, 0, container_->bounds().width() / 2, work_area.height()); 173 return gfx::Rect(
174 0, 0, divider_position_ - kDividerWidth / 2, work_area.height());
142 } 175 }
143 176
144 gfx::Rect SplitViewController::GetRightTargetBounds() { 177 gfx::Rect SplitViewController::GetRightAreaBounds() {
145 gfx::Rect work_area = 178 gfx::Rect work_area =
146 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area(); 179 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area();
147 int container_width = container_->bounds().width(); 180 int container_width = container_->bounds().width();
148 return gfx::Rect( 181 return gfx::Rect(divider_position_ + kDividerWidth / 2,
149 container_width / 2, 0, container_width / 2, work_area.height()); 182 0,
183 container_width - divider_position_ - kDividerWidth / 2,
184 work_area.height());
150 } 185 }
151 186
152 void SplitViewController::SetState(SplitViewController::State state) { 187 void SplitViewController::SetState(SplitViewController::State state) {
153 if (state_ == state) 188 if (state_ == state)
154 return; 189 return;
155 190
156 state_ = state; 191 state_ = state;
157 ScreenManager::Get()->SetRotationLocked(state_ != INACTIVE); 192 ScreenManager::Get()->SetRotationLocked(state_ != INACTIVE);
158 } 193 }
159 194
160 void SplitViewController::UpdateLayout(bool animate) { 195 void SplitViewController::UpdateLayout(bool animate) {
161 CHECK(left_window_); 196 CHECK(left_window_);
162 CHECK(right_window_); 197 CHECK(right_window_);
198 CHECK(divider_widget_);
163 199
164 // Splitview can be activated from SplitViewController::ActivateSplitMode or 200 // Splitview can be activated from SplitViewController::ActivateSplitMode or
165 // SplitViewController::ScrollEnd. Additionally we don't want to rotate the 201 // SplitViewController::ScrollEnd. Additionally we don't want to rotate the
166 // screen while engaging splitview (i.e. state_ == SCROLLING). 202 // screen while engaging splitview (i.e. state_ == SCROLLING).
167 if (state_ == INACTIVE && !animate) { 203 if (state_ == INACTIVE && !animate) {
168 if (!wm::IsActiveWindow(left_window_)) 204 aura::Window* active_window = window_list_provider_->GetWindowList().back();
205 if (active_window != left_window_) {
169 left_window_->Hide(); 206 left_window_->Hide();
170 if (!wm::IsActiveWindow(right_window_)) 207 right_window_->SetBounds(gfx::Rect(container_->bounds()));
208 }
209 if (active_window != right_window_) {
210 left_window_->SetBounds(gfx::Rect(container_->bounds()));
171 right_window_->Hide(); 211 right_window_->Hide();
172 SetWindowTransforms(gfx::Transform(), gfx::Transform(), false); 212 }
213 SetWindowTransforms(
214 gfx::Transform(), gfx::Transform(), gfx::Transform(), false);
173 return; 215 return;
174 } 216 }
175 217
176 left_window_->Show(); 218 left_window_->Show();
177 right_window_->Show(); 219 right_window_->Show();
220 // TODO(mfomitchev): This makes the widget become activated, which may be
221 // bad to do every time we layout? Keeping this for now for consistency, but
222 // should be revisited (if fine - pls remove the comment).
223 divider_widget_->Show();
sadrul 2014/09/12 04:30:36 Consider ShowInactive(), but perhaps the widget sh
mfomitchev 2014/09/12 20:49:07 ShowInactive() explicitly changes the state to ina
224 gfx::Transform divider_transform;
225 divider_transform.Translate(divider_position_ - kDividerWidth / 2, 0);
178 if (state_ == ACTIVE) { 226 if (state_ == ACTIVE) {
227 int container_width = container_->GetBoundsInScreen().width();
228 divider_position_ = container_width / 2;
179 if (animate) { 229 if (animate) {
180 gfx::Transform left_transform = GetTargetTransformForBoundsAnimation( 230 gfx::Transform left_transform =
181 left_window_->bounds(), GetLeftTargetBounds()); 231 GetTransformForBounds(left_window_->bounds(), GetLeftAreaBounds());
182 gfx::Transform right_transform = GetTargetTransformForBoundsAnimation( 232 gfx::Transform right_transform =
183 right_window_->bounds(), GetRightTargetBounds()); 233 GetTransformForBounds(right_window_->bounds(), GetRightAreaBounds());
184 SetWindowTransforms(left_transform, right_transform, true); 234 SetWindowTransforms(
235 left_transform, right_transform, divider_transform, true);
185 } else { 236 } else {
186 left_window_->SetBounds(GetLeftTargetBounds()); 237 left_window_->SetBounds(GetLeftAreaBounds());
187 right_window_->SetBounds(GetRightTargetBounds()); 238 right_window_->SetBounds(GetRightAreaBounds());
188 SetWindowTransforms(gfx::Transform(), gfx::Transform(), false); 239 SetWindowTransforms(
240 gfx::Transform(), gfx::Transform(), divider_transform, false);
189 } 241 }
190 } else { 242 } else {
191 gfx::Transform left_transform; 243 gfx::Transform left_transform;
192 left_transform.Translate(separator_position_ - container_->bounds().width(),
193 0);
194 gfx::Transform right_transform; 244 gfx::Transform right_transform;
195 right_transform.Translate(separator_position_, 0); 245 gfx::Rect left_area_bounds = GetLeftAreaBounds();
196 SetWindowTransforms(left_transform, right_transform, animate); 246 gfx::Rect right_area_bounds = GetRightAreaBounds();
247 // If the width of the window is greater than the width of the area which it
248 // is supposed to occupy - translate the window. Otherwise scale the window
249 // up to fill the target area.
250 if (left_window_->bounds().width() >= left_area_bounds.width()) {
251 left_transform.Translate(divider_position_ - left_window_->bounds().x() -
252 left_window_->bounds().width(),
253 0);
254 } else {
255 left_transform =
256 GetTransformForBounds(left_window_->bounds(), left_area_bounds);
257 }
258 if (right_window_->bounds().width() >= right_area_bounds.width()) {
259 right_transform.Translate(divider_position_ - right_window_->bounds().x(),
260 0);
261 } else {
262 right_transform =
263 GetTransformForBounds(right_window_->bounds(), right_area_bounds);
264 }
265 SetWindowTransforms(
266 left_transform, right_transform, divider_transform, animate);
197 } 267 }
198 // Note: |left_window_| and |right_window_| may be NULL if calling 268 // Note: |left_window_| and |right_window_| may be NULL if calling
199 // SetWindowTransforms(): 269 // SetWindowTransforms():
200 // - caused the in-progress animation to abort. 270 // - caused the in-progress animation to abort.
201 // - started a zero duration animation. 271 // - started a zero duration animation.
202 } 272 }
203 273
204 void SplitViewController::SetWindowTransforms( 274 void SplitViewController::SetWindowTransforms(
205 const gfx::Transform& left_transform, 275 const gfx::Transform& left_transform,
206 const gfx::Transform& right_transform, 276 const gfx::Transform& right_transform,
277 const gfx::Transform& divider_transform,
207 bool animate) { 278 bool animate) {
208 if (animate) { 279 if (animate) {
209 ui::ScopedLayerAnimationSettings left_settings( 280 ui::ScopedLayerAnimationSettings left_settings(
210 left_window_->layer()->GetAnimator()); 281 left_window_->layer()->GetAnimator());
211 left_settings.SetPreemptionStrategy( 282 left_settings.SetPreemptionStrategy(
212 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 283 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
213 left_window_->SetTransform(left_transform); 284 left_window_->SetTransform(left_transform);
214 285
286 if (divider_widget_) {
sadrul 2014/09/12 04:30:36 There's a CHECK in DeactivateSplitMode()/UpdateLay
mfomitchev 2014/09/12 20:49:07 Done.
287 ui::ScopedLayerAnimationSettings divider_settings(
288 divider_widget_->GetNativeWindow()->layer()->GetAnimator());
289 divider_settings.SetPreemptionStrategy(
290 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
291 divider_widget_->GetNativeWindow()->SetTransform(divider_transform);
292 }
293
215 ui::ScopedLayerAnimationSettings right_settings( 294 ui::ScopedLayerAnimationSettings right_settings(
216 right_window_->layer()->GetAnimator()); 295 right_window_->layer()->GetAnimator());
217 right_settings.SetPreemptionStrategy( 296 right_settings.SetPreemptionStrategy(
218 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 297 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
219 right_settings.AddObserver(new ui::ClosureAnimationObserver( 298 right_settings.AddObserver(new ui::ClosureAnimationObserver(
220 base::Bind(&SplitViewController::OnAnimationCompleted, 299 base::Bind(&SplitViewController::OnAnimationCompleted,
221 weak_factory_.GetWeakPtr()))); 300 weak_factory_.GetWeakPtr())));
222 right_window_->SetTransform(right_transform); 301 right_window_->SetTransform(right_transform);
223 } else { 302 } else {
224 left_window_->SetTransform(left_transform); 303 left_window_->SetTransform(left_transform);
225 right_window_->SetTransform(right_transform); 304 right_window_->SetTransform(right_transform);
305 if (divider_widget_)
sadrul 2014/09/12 04:30:36 ditto
mfomitchev 2014/09/12 20:49:07 Done.
306 divider_widget_->GetNativeWindow()->SetTransform(divider_transform);
226 } 307 }
227 } 308 }
228 309
229 void SplitViewController::OnAnimationCompleted() { 310 void SplitViewController::OnAnimationCompleted() {
230 // Animation can be cancelled when deactivated. 311 // Animation can be cancelled when deactivated.
231 if (left_window_ == NULL) 312 if (left_window_ == NULL)
232 return; 313 return;
233 UpdateLayout(false); 314 UpdateLayout(false);
234 315
235 if (state_ == INACTIVE) { 316 if (state_ == INACTIVE) {
236 left_window_ = NULL; 317 left_window_ = NULL;
237 right_window_ = NULL; 318 right_window_ = NULL;
319 divider_widget_.reset();
238 } 320 }
239 } 321 }
240 322
241 void SplitViewController::UpdateSeparatorPositionFromScrollDelta(float delta) { 323 void SplitViewController::UpdateSeparatorPositionFromScrollDelta(float delta) {
242 gfx::Screen* screen = gfx::Screen::GetScreenFor(container_); 324 gfx::Screen* screen = gfx::Screen::GetScreenFor(container_);
243 const gfx::Rect& display_bounds = 325 const gfx::Rect& display_bounds =
244 screen->GetDisplayNearestWindow(container_).bounds(); 326 screen->GetDisplayNearestWindow(container_).bounds();
245 gfx::Rect container_bounds = container_->GetBoundsInScreen(); 327 gfx::Rect container_bounds = container_->GetBoundsInScreen();
246 separator_position_ = 328 divider_position_ =
247 delta > 0 ? ((int)delta) + display_bounds.x() - container_bounds.x() 329 delta > 0 ? ((int)delta) + display_bounds.x() - container_bounds.x()
248 : display_bounds.right() - container_bounds.x() + delta; 330 : display_bounds.right() - container_bounds.x() + delta;
249 } 331 }
250 332
251 /////////////////////////////////////////////////////////////////////////////// 333 ///////////////////////////////////////////////////////////////////////////////
252 // BezelController::ScrollDelegate: 334 // BezelController::ScrollDelegate:
253 335
254 void SplitViewController::ScrollBegin(BezelController::Bezel bezel, 336 void SplitViewController::ScrollBegin(BezelController::Bezel bezel,
255 float delta) { 337 float delta) {
256 if (!CanScroll()) 338 if (!CanScroll())
(...skipping 10 matching lines...) Expand all
267 right_window_ = current_window; 349 right_window_ = current_window;
268 left_window_ = *(iter + 1); 350 left_window_ = *(iter + 1);
269 } else { 351 } else {
270 left_window_ = current_window; 352 left_window_ = current_window;
271 right_window_ = *(iter + 1); 353 right_window_ = *(iter + 1);
272 } 354 }
273 355
274 CHECK(left_window_); 356 CHECK(left_window_);
275 CHECK(right_window_); 357 CHECK(right_window_);
276 358
359 CHECK(!divider_widget_);
360 divider_widget_.reset(CreateDividerWidget());
361 divider_widget_->Show();
362
277 UpdateSeparatorPositionFromScrollDelta(delta); 363 UpdateSeparatorPositionFromScrollDelta(delta);
278 UpdateLayout(false); 364 UpdateLayout(false);
279 } 365 }
280 366
281 void SplitViewController::ScrollEnd() { 367 void SplitViewController::ScrollEnd() {
282 if (state_ != SCROLLING) 368 if (state_ != SCROLLING)
283 return; 369 return;
284 370
285 // Max distance from the scroll end position to the middle of the screen where 371 // Max distance from the scroll end position to the middle of the screen where
286 // we would go into the split view mode. 372 // we would go into the split view mode.
287 const int kMaxDistanceFromMiddle = 120; 373 const int kMaxDistanceFromMiddle = 120;
288 int container_width = container_->GetBoundsInScreen().width(); 374 int container_width = container_->GetBoundsInScreen().width();
289 if (std::abs(container_width / 2 - separator_position_) <= 375 if (std::abs(container_width / 2 - divider_position_) <=
290 kMaxDistanceFromMiddle) { 376 kMaxDistanceFromMiddle) {
291 SetState(ACTIVE); 377 SetState(ACTIVE);
292 separator_position_ = container_width / 2; 378 } else if (divider_position_ < container_width / 2) {
293 } else if (separator_position_ < container_width / 2) { 379 divider_position_ = 0;
294 separator_position_ = 0;
295 SetState(INACTIVE); 380 SetState(INACTIVE);
296 wm::ActivateWindow(right_window_); 381 wm::ActivateWindow(right_window_);
297 } else { 382 } else {
298 separator_position_ = container_width; 383 divider_position_ = container_width;
299 SetState(INACTIVE); 384 SetState(INACTIVE);
300 wm::ActivateWindow(left_window_); 385 wm::ActivateWindow(left_window_);
301 } 386 }
302 UpdateLayout(true); 387 UpdateLayout(true);
303 } 388 }
304 389
305 void SplitViewController::ScrollUpdate(float delta) { 390 void SplitViewController::ScrollUpdate(float delta) {
306 if (state_ != SCROLLING) 391 if (state_ != SCROLLING)
307 return; 392 return;
308 UpdateSeparatorPositionFromScrollDelta(delta); 393 UpdateSeparatorPositionFromScrollDelta(delta);
309 UpdateLayout(false); 394 UpdateLayout(false);
310 } 395 }
311 396
312 bool SplitViewController::CanScroll() { 397 bool SplitViewController::CanScroll() {
313 // TODO(mfomitchev): return false in full screen. 398 // TODO(mfomitchev): return false in full screen.
314 bool result = (!IsSplitViewModeActive() && 399 bool result = (!IsSplitViewModeActive() &&
315 window_list_provider_->GetWindowList().size() >= 2 && 400 window_list_provider_->GetWindowList().size() >= 2 &&
316 IsLandscapeOrientation(gfx::Screen::GetNativeScreen()-> 401 IsLandscapeOrientation(gfx::Screen::GetNativeScreen()->
317 GetDisplayNearestWindow(container_).rotation())); 402 GetDisplayNearestWindow(container_).rotation()));
318 return result; 403 return result;
319 } 404 }
320 405
406 ///////////////////////////////////////////////////////////////////////////////
407 // ScrollHandle::ScrollDelegate:
408
409 void SplitViewController::HandleScrollBegin(float delta) {
410 CHECK(state_ == ACTIVE);
411 state_ = SCROLLING;
412 divider_position_ = delta + divider_position_;
413 UpdateLayout(false);
414 }
415
416 void SplitViewController::HandleScrollEnd() {
417 ScrollEnd();
418 }
419
420 void SplitViewController::HandleScrollUpdate(float delta) {
421 if (state_ != SCROLLING)
422 return;
423 divider_position_ = delta + container_->GetBoundsInScreen().width() / 2;
424 UpdateLayout(false);
425 }
426
427 bool SplitViewController::HandleCanScroll() {
428 CHECK(IsLandscapeOrientation(gfx::Screen::GetNativeScreen()
429 ->GetDisplayNearestWindow(container_)
430 .rotation()));
431 return true;
432 }
433
434 ///////////////////////////////////////////////////////////////////////////////
435 // WindowManagerObserver:
436
437 void SplitViewController::OnOverviewModeEnter() {
438 if (divider_widget_)
439 divider_widget_->Hide();
440 }
441
442 void SplitViewController::OnOverviewModeExit() {
443 if (divider_widget_)
444 divider_widget_->Show();
445 }
446
447 void SplitViewController::OnActivityOrderHasChanged() {
448 }
449
321 } // namespace athena 450 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698