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

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

Issue 459613008: athena: Allow getting into split-view mode from overview-mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « athena/wm/split_view_controller.h ('k') | athena/wm/window_manager_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/wm/public/window_list_provider.h" 9 #include "athena/wm/public/window_list_provider.h"
10 #include "athena/wm/public/window_manager.h" 10 #include "athena/wm/public/window_manager.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 SplitViewController::~SplitViewController() { 62 SplitViewController::~SplitViewController() {
63 window_manager_->RemoveObserver(this); 63 window_manager_->RemoveObserver(this);
64 } 64 }
65 65
66 bool SplitViewController::IsSplitViewModeActive() const { 66 bool SplitViewController::IsSplitViewModeActive() const {
67 return state_ == ACTIVE; 67 return state_ == ACTIVE;
68 } 68 }
69 69
70 void SplitViewController::ActivateSplitMode(aura::Window* left,
71 aura::Window* right) {
72 aura::Window::Windows windows = window_list_provider_->GetWindowList();
73 aura::Window::Windows::reverse_iterator iter = windows.rbegin();
74 if (state_ == ACTIVE) {
75 if (!left)
76 left = left_window_;
77 if (!right)
78 right = right_window_;
79 }
80
81 if (!left && iter != windows.rend()) {
82 left = *iter;
83 iter++;
84 if (left == right && iter != windows.rend()) {
85 left = *iter;
86 iter++;
87 }
88 }
89
90 if (!right && iter != windows.rend()) {
91 right = *iter;
92 iter++;
93 if (right == left && iter != windows.rend()) {
94 right = *iter;
95 iter++;
96 }
97 }
98
99 state_ = ACTIVE;
100 left_window_ = left;
101 right_window_ = right;
102 container_->StackChildAtTop(right_window_);
103 container_->StackChildAtTop(left_window_);
104 UpdateLayout(true);
105 }
106
70 void SplitViewController::UpdateLayout(bool animate) { 107 void SplitViewController::UpdateLayout(bool animate) {
71 if (!left_window_) 108 if (!left_window_)
72 return; 109 return;
73 CHECK(right_window_); 110 CHECK(right_window_);
74 gfx::Transform left_transform; 111 gfx::Transform left_transform;
75 gfx::Transform right_transform; 112 gfx::Transform right_transform;
76 int container_width = container_->GetBoundsInScreen().width(); 113 int container_width = container_->GetBoundsInScreen().width();
77 if (state_ == ACTIVE) { 114 if (state_ == ACTIVE) {
78 // This method should only be called once in ACTIVE state when 115 // This method should only be called once in ACTIVE state when
79 // the left and rightwindows are still full screen and need to be resized. 116 // the left and rightwindows are still full screen and need to be resized.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 state_ = INACTIVE; 304 state_ = INACTIVE;
268 left_window_ = NULL; 305 left_window_ = NULL;
269 right_window_ = NULL; 306 right_window_ = NULL;
270 current_activity_window_ = NULL; 307 current_activity_window_ = NULL;
271 } 308 }
272 309
273 void SplitViewController::OnOverviewModeExit() { 310 void SplitViewController::OnOverviewModeExit() {
274 } 311 }
275 312
276 } // namespace athena 313 } // namespace athena
OLDNEW
« no previous file with comments | « athena/wm/split_view_controller.h ('k') | athena/wm/window_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698