summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorafakhry <afakhry@chromium.org>2014-12-05 17:23:48 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-06 01:24:25 +0000
commitf3848eee6c17acc74543c803bcea7ea542e13cbc (patch)
tree0c1897cf2e2451607f93b60b2e7a751e9bbdd7fd
parentedef0ee80a3cb3b3d0d429c96cd124a390b500c7 (diff)
downloadchromium_src-f3848eee6c17acc74543c803bcea7ea542e13cbc.zip
chromium_src-f3848eee6c17acc74543c803bcea7ea542e13cbc.tar.gz
chromium_src-f3848eee6c17acc74543c803bcea7ea542e13cbc.tar.bz2
Cleaning up MruWindowTracker::BuildWindowList()
Removing the top_most_at_end parameter which was always set to false and was never used. R=oshima@chromium.org BUG=None Review URL: https://codereview.chromium.org/786513003 Cr-Commit-Position: refs/heads/master@{#307135}
-rw-r--r--ash/accelerators/accelerator_controller.cc2
-rw-r--r--ash/focus_cycler.cc2
-rw-r--r--ash/shelf/shelf_layout_manager.cc2
-rw-r--r--ash/wm/maximize_mode/maximize_mode_window_manager.cc3
-rw-r--r--ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc9
-rw-r--r--ash/wm/mru_window_tracker.cc23
-rw-r--r--ash/wm/mru_window_tracker.h7
-rw-r--r--ash/wm/window_positioner.cc4
-rw-r--r--chrome/browser/chromeos/extensions/wallpaper_private_api.cc3
9 files changed, 21 insertions, 34 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 4e56e5a..5eb5bb1 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -1133,7 +1133,7 @@ AcceleratorController::GetAcceleratorProcessingRestriction(int action) {
actions_allowed_in_app_mode_.end()) {
return RESTRICTION_PREVENT_PROCESSING;
}
- if (MruWindowTracker::BuildWindowList(false).empty() &&
+ if (MruWindowTracker::BuildWindowList().empty() &&
actions_needing_window_.find(action) != actions_needing_window_.end()) {
Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert(
ui::A11Y_ALERT_WINDOW_NEEDED);
diff --git a/ash/focus_cycler.cc b/ash/focus_cycler.cc
index b0d6d4d..2ccf256 100644
--- a/ash/focus_cycler.cc
+++ b/ash/focus_cycler.cc
@@ -19,7 +19,7 @@ namespace ash {
namespace {
bool HasFocusableWindow() {
- return !MruWindowTracker::BuildWindowList(false).empty();
+ return !MruWindowTracker::BuildWindowList().empty();
}
} // namespace
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 7f1667c..08831e2 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -1031,7 +1031,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
return SHELF_AUTO_HIDE_SHOWN;
const std::vector<aura::Window*> windows =
- ash::MruWindowTracker::BuildWindowList(false);
+ ash::MruWindowTracker::BuildWindowList();
// Process the window list and check if there are any visible windows.
bool visible_window = false;
diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager.cc b/ash/wm/maximize_mode/maximize_mode_window_manager.cc
index 6b7fc36..7506bee 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_manager.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_manager.cc
@@ -182,8 +182,7 @@ MaximizeModeWindowManager::MaximizeModeWindowManager()
}
void MaximizeModeWindowManager::MaximizeAllWindows() {
- MruWindowTracker::WindowList windows =
- MruWindowTracker::BuildWindowList(false);
+ MruWindowTracker::WindowList windows = MruWindowTracker::BuildWindowList();
// Add all existing Mru windows.
for (MruWindowTracker::WindowList::iterator window = windows.begin();
window != windows.end(); ++window) {
diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
index 534108a..d2e06a1 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
@@ -679,8 +679,7 @@ TEST_F(MaximizeModeWindowManagerTest, ModeChangeKeepsMRUOrder) {
// The windows should be in the reverse order of creation in the MRU list.
{
- MruWindowTracker::WindowList windows =
- MruWindowTracker::BuildWindowList(false);
+ MruWindowTracker::WindowList windows = MruWindowTracker::BuildWindowList();
EXPECT_EQ(w1.get(), windows[4]);
EXPECT_EQ(w2.get(), windows[3]);
EXPECT_EQ(w3.get(), windows[2]);
@@ -693,8 +692,7 @@ TEST_F(MaximizeModeWindowManagerTest, ModeChangeKeepsMRUOrder) {
ASSERT_TRUE(manager);
EXPECT_EQ(5, manager->GetNumberOfManagedWindows());
{
- MruWindowTracker::WindowList windows =
- MruWindowTracker::BuildWindowList(false);
+ MruWindowTracker::WindowList windows = MruWindowTracker::BuildWindowList();
// We do not test maximization here again since that was done already.
EXPECT_EQ(w1.get(), windows[4]);
EXPECT_EQ(w2.get(), windows[3]);
@@ -706,8 +704,7 @@ TEST_F(MaximizeModeWindowManagerTest, ModeChangeKeepsMRUOrder) {
// Destroying should still keep the order.
DestroyMaximizeModeWindowManager();
{
- MruWindowTracker::WindowList windows =
- MruWindowTracker::BuildWindowList(false);
+ MruWindowTracker::WindowList windows = MruWindowTracker::BuildWindowList();
// We do not test maximization here again since that was done already.
EXPECT_EQ(w1.get(), windows[4]);
EXPECT_EQ(w2.get(), windows[3]);
diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc
index ef00dfc..6b8b4cf 100644
--- a/ash/wm/mru_window_tracker.cc
+++ b/ash/wm/mru_window_tracker.cc
@@ -45,20 +45,17 @@ void AddDraggedWindows(aura::Window* root,
}
}
-// Returns whether |w1| should be considered less recently used than |w2|. This
+// Returns whether |w1| should be considered more recently used than |w2|. This
// is used for a stable sort to move minimized windows to the LRU end of the
// list.
bool CompareWindowState(aura::Window* w1, aura::Window* w2) {
- return ash::wm::IsWindowMinimized(w1) && !ash::wm::IsWindowMinimized(w2);
+ return !(ash::wm::IsWindowMinimized(w1) && !ash::wm::IsWindowMinimized(w2));
}
// Returns a list of windows ordered by their stacking order.
// If |mru_windows| is passed, these windows are moved to the front of the list.
-// If |top_most_at_end|, the list is returned in descending (bottom-most / least
-// recently used) order.
MruWindowTracker::WindowList BuildWindowListInternal(
- const std::list<aura::Window*>* mru_windows,
- bool top_most_at_end) {
+ const std::list<aura::Window*>* mru_windows) {
MruWindowTracker::WindowList windows;
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
@@ -111,12 +108,9 @@ MruWindowTracker::WindowList BuildWindowListInternal(
}
}
- // Move minimized windows to the beginning (LRU end) of the list.
- std::stable_sort(windows.begin(), windows.end(), CompareWindowState);
-
// Window cycling expects the topmost window at the front of the list.
- if (!top_most_at_end)
- std::reverse(windows.begin(), windows.end());
+ // Move minimized windows to the end (LRU end) of the list.
+ std::stable_sort(windows.begin(), windows.end(), CompareWindowState);
return windows;
}
@@ -143,13 +137,12 @@ MruWindowTracker::~MruWindowTracker() {
}
// static
-MruWindowTracker::WindowList MruWindowTracker::BuildWindowList(
- bool top_most_at_end) {
- return BuildWindowListInternal(NULL, top_most_at_end);
+MruWindowTracker::WindowList MruWindowTracker::BuildWindowList() {
+ return BuildWindowListInternal(NULL);
}
MruWindowTracker::WindowList MruWindowTracker::BuildMruWindowList() {
- return BuildWindowListInternal(&mru_windows_, false);
+ return BuildWindowListInternal(&mru_windows_);
}
void MruWindowTracker::SetIgnoreActivations(bool ignore) {
diff --git a/ash/wm/mru_window_tracker.h b/ash/wm/mru_window_tracker.h
index 6f6dd5f..4ed06a3 100644
--- a/ash/wm/mru_window_tracker.h
+++ b/ash/wm/mru_window_tracker.h
@@ -40,10 +40,9 @@ class ASH_EXPORT MruWindowTracker
// the vector based on the current set of windows across all valid root
// windows. As a result it is not necessarily the same as the set of
// windows being iterated over.
- // If |top_most_at_end| the window list will return in ascending (lowest
- // window in stacking order first) order instead of the default descending
- // (top most window first) order.
- static WindowList BuildWindowList(bool top_most_at_end);
+ // The returned window list will be in descending (top most window first)
+ // order.
+ static WindowList BuildWindowList();
// Returns the set of windows which can be cycled through using the tracked
// list of most recently used windows.
diff --git a/ash/wm/window_positioner.cc b/ash/wm/window_positioner.cc
index 73b7d09..880abd1 100644
--- a/ash/wm/window_positioner.cc
+++ b/ash/wm/window_positioner.cc
@@ -192,7 +192,7 @@ aura::Window* GetReferenceWindow(const aura::Window* root_window,
// Get a list of all windows.
const std::vector<aura::Window*> windows =
- ash::MruWindowTracker::BuildWindowList(false);
+ ash::MruWindowTracker::BuildWindowList();
if (windows.empty())
return NULL;
@@ -504,7 +504,7 @@ gfx::Rect WindowPositioner::SmartPopupPosition(
const gfx::Rect& work_area,
int grid) {
const std::vector<aura::Window*> windows =
- MruWindowTracker::BuildWindowList(false);
+ MruWindowTracker::BuildWindowList();
std::vector<const gfx::Rect*> regions;
// Process the window list and check if we can bail immediately.
diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
index cf2acdb..40e8522 100644
--- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
+++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc
@@ -173,8 +173,7 @@ void WindowStateManager::BuildWindowListAndMinimizeInactiveForUser(
std::set<aura::Window*>* results =
&user_id_hash_window_list_map_[user_id_hash];
- std::vector<aura::Window*> windows =
- ash::MruWindowTracker::BuildWindowList(false);
+ std::vector<aura::Window*> windows = ash::MruWindowTracker::BuildWindowList();
for (std::vector<aura::Window*>::iterator iter = windows.begin();
iter != windows.end(); ++iter) {