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

Side by Side Diff: ash/wm/overview/window_selector_controller.cc

Issue 2918403006: CrOS Tablet Window management - Split Screen part I (Closed)
Patch Set: Fix failed tests. Created 3 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/wm/overview/window_selector_controller.h" 5 #include "ash/wm/overview/window_selector_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/session/session_controller.h" 9 #include "ash/session/session_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/shell_port.h" 11 #include "ash/shell_port.h"
12 #include "ash/wm/mru_window_tracker.h" 12 #include "ash/wm/mru_window_tracker.h"
13 #include "ash/wm/overview/window_selector.h" 13 #include "ash/wm/overview/window_selector.h"
14 #include "ash/wm/screen_pinning_controller.h" 14 #include "ash/wm/screen_pinning_controller.h"
15 #include "ash/wm/splitview/split_view_controller.h"
15 #include "ash/wm/window_state.h" 16 #include "ash/wm/window_state.h"
16 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
17 18
18 namespace ash { 19 namespace ash {
19 20
20 WindowSelectorController::WindowSelectorController() {} 21 WindowSelectorController::WindowSelectorController() {}
21 22
22 WindowSelectorController::~WindowSelectorController() { 23 WindowSelectorController::~WindowSelectorController() {
23 // Destroy widgets that may be still animating if shell shuts down soon after 24 // Destroy widgets that may be still animating if shell shuts down soon after
24 // exiting overview mode. 25 // exiting overview mode.
(...skipping 22 matching lines...) Expand all
47 // Don't start overview if window selection is not allowed. 48 // Don't start overview if window selection is not allowed.
48 if (!CanSelect()) 49 if (!CanSelect())
49 return false; 50 return false;
50 51
51 auto windows = Shell::Get()->mru_window_tracker()->BuildMruWindowList(); 52 auto windows = Shell::Get()->mru_window_tracker()->BuildMruWindowList();
52 auto end = 53 auto end =
53 std::remove_if(windows.begin(), windows.end(), 54 std::remove_if(windows.begin(), windows.end(),
54 std::not1(std::ptr_fun(&WindowSelector::IsSelectable))); 55 std::not1(std::ptr_fun(&WindowSelector::IsSelectable)));
55 windows.resize(end - windows.begin()); 56 windows.resize(end - windows.begin());
56 57
57 // Don't enter overview mode with no windows. 58 if (!Shell::Get()->IsSplitViewModeActive()) {
58 if (windows.empty()) 59 // Don't enter overview with no window if the split view mode is inactive.
59 return false; 60 if (windows.empty())
61 return false;
62 } else {
63 // Don't enter overview with less than 1 window if the split view mode is
64 // active.
65 if (windows.size() <= 1)
66 return false;
67
68 // Remove the default snapped window from the window list. The default
69 // snapped window occupy one side of the screen, while the other windows
70 // occupy the other side of the screen in overview mode.
oshima 2017/06/14 05:45:47 can you also mention where the default window will
xdai1 2017/06/15 22:11:42 Done.
71 aura::Window* default_snapped_window =
72 Shell::Get()->split_view_controller()->GetDefaultSnappedWindow();
73 auto iter =
74 std::find(windows.begin(), windows.end(), default_snapped_window);
75 DCHECK(iter != windows.end());
oshima 2017/06/14 00:19:27 DCHECK_NE
xdai1 2017/06/15 22:11:42 DCHECK_NE could not be used to compare two iterato
76 windows.erase(iter);
77 }
60 78
61 Shell::Get()->NotifyOverviewModeStarting(); 79 Shell::Get()->NotifyOverviewModeStarting();
62 window_selector_.reset(new WindowSelector(this)); 80 window_selector_.reset(new WindowSelector(this));
63 window_selector_->Init(windows); 81 window_selector_->Init(windows);
64 OnSelectionStarted(); 82 OnSelectionStarted();
65 } 83 }
66 return true; 84 return true;
67 } 85 }
68 86
69 bool WindowSelectorController::IsSelecting() const { 87 bool WindowSelectorController::IsSelecting() const {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 138 }
121 139
122 void WindowSelectorController::OnSelectionStarted() { 140 void WindowSelectorController::OnSelectionStarted() {
123 if (!last_selection_time_.is_null()) { 141 if (!last_selection_time_.is_null()) {
124 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", 142 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse",
125 base::Time::Now() - last_selection_time_); 143 base::Time::Now() - last_selection_time_);
126 } 144 }
127 } 145 }
128 146
129 } // namespace ash 147 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698