summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/wm/maximize_mode/maximize_mode_window_manager.cc4
-rw-r--r--ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc18
-rw-r--r--ash/wm/mru_window_tracker.cc17
-rw-r--r--ash/wm/mru_window_tracker_unittest.cc23
4 files changed, 17 insertions, 45 deletions
diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager.cc b/ash/wm/maximize_mode/maximize_mode_window_manager.cc
index 7adcc00..28a71d0 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_manager.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_manager.cc
@@ -260,10 +260,6 @@ bool MaximizeModeWindowManager::ShouldHandleWindow(aura::Window* window) {
if (window->GetProperty(aura::client::kAlwaysOnTopKey))
return false;
- // Windows in the dock should not be managed by us.
- if (wm::GetWindowState(window)->IsDocked())
- return false;
-
return window->type() == ui::wm::WINDOW_TYPE_NORMAL;
}
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 274956e..8011efe 100644
--- a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc
@@ -1367,24 +1367,6 @@ TEST_F(MaximizeModeWindowManagerTest, AlwaysOnTopWindows) {
EXPECT_TRUE(wm::GetWindowState(w1.get())->can_be_dragged());
EXPECT_TRUE(wm::GetWindowState(w2.get())->can_be_dragged());
}
-
-// Tests that docked windows are not maximized, and not tracked.
-TEST_F(MaximizeModeWindowManagerTest, DontMaximizeDockedWindows) {
- gfx::Rect rect(10, 10, 200, 50);
- scoped_ptr<aura::Window> window(
- CreateWindow(ui::wm::WINDOW_TYPE_NORMAL, rect));
-
- wm::WMEvent dock_event(wm::WM_EVENT_DOCK);
- wm::GetWindowState(window.get())->OnWMEvent(&dock_event);
- EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked());
- EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
-
- ash::MaximizeModeWindowManager* manager = CreateMaximizeModeWindowManager();
- EXPECT_TRUE(wm::GetWindowState(window.get())->IsDocked());
- EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized());
- EXPECT_EQ(0, manager->GetNumberOfManagedWindows());
-}
-
#endif // OS_WIN
} // namespace ash
diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc
index 2c38e0d..f006d45 100644
--- a/ash/wm/mru_window_tracker.cc
+++ b/ash/wm/mru_window_tracker.cc
@@ -36,6 +36,19 @@ void AddTrackedWindows(aura::Window* root,
windows->insert(windows->end(), children.begin(), children.end());
}
+// Adds windows being dragged in the docked container to |windows| list.
+void AddDraggedWindows(aura::Window* root,
+ MruWindowTracker::WindowList* windows) {
+ aura::Window* container =
+ Shell::GetContainer(root, kShellWindowId_DockedContainer);
+ const MruWindowTracker::WindowList& children = container->children();
+ for (MruWindowTracker::WindowList::const_iterator iter = children.begin();
+ iter != children.end(); ++iter) {
+ if (wm::GetWindowState(*iter)->is_dragged())
+ windows->insert(windows->end(), *iter);
+ }
+}
+
// Returns whether |w1| should be considered less recently used than |w2|. This
// is used for a stable sort to move minimized windows to the LRU end of the
// list.
@@ -67,6 +80,10 @@ MruWindowTracker::WindowList BuildWindowListInternal(
for (size_t i = 0; i < kSwitchableWindowContainerIdsLength; ++i)
AddTrackedWindows(active_root, kSwitchableWindowContainerIds[i], &windows);
+ // Dragged windows are temporarily parented in docked container. Include them
+ // in the in tracked list.
+ AddDraggedWindows(active_root, &windows);
+
// Removes unfocusable windows.
std::vector<aura::Window*>::iterator itr = windows.begin();
while (itr != windows.end()) {
diff --git a/ash/wm/mru_window_tracker_unittest.cc b/ash/wm/mru_window_tracker_unittest.cc
index 4aff599..a7bec73 100644
--- a/ash/wm/mru_window_tracker_unittest.cc
+++ b/ash/wm/mru_window_tracker_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "ash/shell.h"
-#include "ash/shell_window_ids.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/test_shelf_delegate.h"
#include "ash/wm/mru_window_tracker.h"
@@ -12,7 +11,6 @@
#include "base/compiler_specific.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
-#include "ui/base/hit_test.h"
#include "ui/views/widget/widget.h"
namespace ash {
@@ -82,25 +80,4 @@ TEST_F(MruWindowTrackerTest, MinimizedWindowsAreLru) {
EXPECT_EQ(w5.get(), window_list[5]);
}
-// Tests that windows being dragged are only in the WindowList once.
-TEST_F(MruWindowTrackerTest, DraggedWindowsInListOnlyOnce) {
- scoped_ptr<aura::Window> w1(CreateWindow());
- wm::ActivateWindow(w1.get());
-
- // Start dragging the window.
- wm::GetWindowState(w1.get())->CreateDragDetails(
- w1.get(), gfx::Point(), HTRIGHT, aura::client::WINDOW_MOVE_SOURCE_TOUCH);
-
- // During a drag the window is reparented by the Docked container.
- aura::Window* drag_container = Shell::GetContainer(
- Shell::GetTargetRootWindow(), kShellWindowId_DockedContainer);
- drag_container->AddChild(w1.get());
- EXPECT_TRUE(wm::GetWindowState(w1.get())->is_dragged());
-
- // The dragged window should only be in the list once.
- MruWindowTracker::WindowList window_list =
- mru_window_tracker()->BuildWindowListIgnoreModal();
- EXPECT_EQ(1, std::count(window_list.begin(), window_list.end(), w1.get()));
-}
-
} // namespace ash