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

Unified Diff: ash/wm/overview/window_selector_controller.cc

Issue 2087153003: Moves common code in ash/wm/overview to ash/common/wm/overview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/overview/window_selector_controller.h ('k') | ash/wm/overview/window_selector_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/overview/window_selector_controller.cc
diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc
deleted file mode 100644
index 9cf3e6589763824d68b7a7c5ac55971ab46ea509..0000000000000000000000000000000000000000
--- a/ash/wm/overview/window_selector_controller.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/wm/overview/window_selector_controller.h"
-
-#include <vector>
-
-#include "ash/common/session/session_state_delegate.h"
-#include "ash/common/system/tray/system_tray_delegate.h"
-#include "ash/common/wm/mru_window_tracker.h"
-#include "ash/common/wm/window_state.h"
-#include "ash/common/wm_shell.h"
-#include "ash/common/wm_window.h"
-#include "ash/wm/overview/window_selector.h"
-#include "base/metrics/histogram.h"
-
-namespace ash {
-
-WindowSelectorController::WindowSelectorController() {
-}
-
-WindowSelectorController::~WindowSelectorController() {
-}
-
-// static
-bool WindowSelectorController::CanSelect() {
- // Don't allow a window overview if the screen is locked or a modal dialog is
- // open or running in kiosk app session.
- SessionStateDelegate* session_state_delegate =
- WmShell::Get()->GetSessionStateDelegate();
- return session_state_delegate->IsActiveUserSessionStarted() &&
- !session_state_delegate->IsScreenLocked() &&
- !WmShell::Get()->IsSystemModalWindowOpen() &&
- !WmShell::Get()->IsPinned() &&
- WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() !=
- LoginStatus::KIOSK_APP;
-}
-
-void WindowSelectorController::ToggleOverview() {
- if (IsSelecting()) {
- OnSelectionEnded();
- } else {
- // Don't start overview if window selection is not allowed.
- if (!CanSelect())
- return;
-
- std::vector<WmWindow*> windows =
- WmShell::Get()->GetMruWindowTracker()->BuildMruWindowList();
- auto end =
- std::remove_if(windows.begin(), windows.end(),
- std::not1(std::ptr_fun(&WindowSelector::IsSelectable)));
- windows.resize(end - windows.begin());
-
- // Don't enter overview mode with no windows.
- if (windows.empty())
- return;
-
- WmShell::Get()->OnOverviewModeStarting();
- window_selector_.reset(new WindowSelector(this));
- window_selector_->Init(windows);
- OnSelectionStarted();
- }
-}
-
-bool WindowSelectorController::IsSelecting() {
- return window_selector_.get() != NULL;
-}
-
-bool WindowSelectorController::IsRestoringMinimizedWindows() const {
- return window_selector_.get() != NULL &&
- window_selector_->restoring_minimized_windows();
-}
-
-// TODO(flackr): Make WindowSelectorController observe the activation of
-// windows, so we can remove WindowSelectorDelegate.
-void WindowSelectorController::OnSelectionEnded() {
- window_selector_->Shutdown();
- window_selector_.reset();
- last_selection_time_ = base::Time::Now();
- WmShell::Get()->OnOverviewModeEnded();
-}
-
-void WindowSelectorController::OnSelectionStarted() {
- if (!last_selection_time_.is_null()) {
- UMA_HISTOGRAM_LONG_TIMES(
- "Ash.WindowSelector.TimeBetweenUse",
- base::Time::Now() - last_selection_time_);
- }
-}
-
-} // namespace ash
« no previous file with comments | « ash/wm/overview/window_selector_controller.h ('k') | ash/wm/overview/window_selector_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698