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

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

Issue 2499453002: Add ink drop ripple to overview mode button (Closed)
Patch Set: Rebased Created 4 years, 1 month 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/common/wm/overview/window_selector_controller.h" 5 #include "ash/common/wm/overview/window_selector_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/system/tray/system_tray_delegate.h" 10 #include "ash/common/system/tray/system_tray_delegate.h"
(...skipping 24 matching lines...) Expand all
35 SessionStateDelegate* session_state_delegate = 35 SessionStateDelegate* session_state_delegate =
36 WmShell::Get()->GetSessionStateDelegate(); 36 WmShell::Get()->GetSessionStateDelegate();
37 return session_state_delegate->IsActiveUserSessionStarted() && 37 return session_state_delegate->IsActiveUserSessionStarted() &&
38 !session_state_delegate->IsScreenLocked() && 38 !session_state_delegate->IsScreenLocked() &&
39 !WmShell::Get()->IsSystemModalWindowOpen() && 39 !WmShell::Get()->IsSystemModalWindowOpen() &&
40 !WmShell::Get()->IsPinned() && 40 !WmShell::Get()->IsPinned() &&
41 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != 41 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() !=
42 LoginStatus::KIOSK_APP; 42 LoginStatus::KIOSK_APP;
43 } 43 }
44 44
45 void WindowSelectorController::ToggleOverview() { 45 bool WindowSelectorController::ToggleOverview() {
46 if (IsSelecting()) { 46 if (IsSelecting()) {
47 OnSelectionEnded(); 47 OnSelectionEnded();
48 } else { 48 } else {
49 // Don't start overview if window selection is not allowed. 49 // Don't start overview if window selection is not allowed.
50 if (!CanSelect()) 50 if (!CanSelect())
51 return; 51 return false;
52 52
53 std::vector<WmWindow*> windows = 53 std::vector<WmWindow*> windows =
54 WmShell::Get()->mru_window_tracker()->BuildMruWindowList(); 54 WmShell::Get()->mru_window_tracker()->BuildMruWindowList();
55 auto end = 55 auto end =
56 std::remove_if(windows.begin(), windows.end(), 56 std::remove_if(windows.begin(), windows.end(),
57 std::not1(std::ptr_fun(&WindowSelector::IsSelectable))); 57 std::not1(std::ptr_fun(&WindowSelector::IsSelectable)));
58 windows.resize(end - windows.begin()); 58 windows.resize(end - windows.begin());
59 59
60 // Don't enter overview mode with no windows. 60 // Don't enter overview mode with no windows.
61 if (windows.empty()) 61 if (windows.empty())
62 return; 62 return false;
63 63
64 WmShell::Get()->OnOverviewModeStarting(); 64 WmShell::Get()->OnOverviewModeStarting();
65 window_selector_.reset(new WindowSelector(this)); 65 window_selector_.reset(new WindowSelector(this));
66 window_selector_->Init(windows); 66 window_selector_->Init(windows);
67 OnSelectionStarted(); 67 OnSelectionStarted();
68 } 68 }
69 return true;
69 } 70 }
70 71
71 bool WindowSelectorController::IsSelecting() const { 72 bool WindowSelectorController::IsSelecting() const {
72 return window_selector_.get() != NULL; 73 return window_selector_.get() != NULL;
73 } 74 }
74 75
75 bool WindowSelectorController::IsRestoringMinimizedWindows() const { 76 bool WindowSelectorController::IsRestoringMinimizedWindows() const {
76 return window_selector_.get() != NULL && 77 return window_selector_.get() != NULL &&
77 window_selector_->restoring_minimized_windows(); 78 window_selector_->restoring_minimized_windows();
78 } 79 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 113 }
113 114
114 void WindowSelectorController::OnSelectionStarted() { 115 void WindowSelectorController::OnSelectionStarted() {
115 if (!last_selection_time_.is_null()) { 116 if (!last_selection_time_.is_null()) {
116 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", 117 UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse",
117 base::Time::Now() - last_selection_time_); 118 base::Time::Now() - last_selection_time_);
118 } 119 }
119 } 120 }
120 121
121 } // namespace ash 122 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector_controller.h ('k') | ash/system/overview/overview_button_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698