| OLD | NEW |
| 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/workspace_controller.h" | 5 #include "ash/common/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" | |
| 10 #include "ash/common/shelf/shelf_layout_manager.h" | 9 #include "ash/common/shelf/shelf_layout_manager.h" |
| 11 #include "ash/common/shelf/shelf_widget.h" | 10 #include "ash/common/shelf/shelf_widget.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
| 13 #include "ash/common/system/status_area_widget.h" | 12 #include "ash/common/system/status_area_widget.h" |
| 14 #include "ash/common/test/test_shelf_delegate.h" | 13 #include "ash/common/test/test_shelf_delegate.h" |
| 15 #include "ash/common/wm/panels/panel_layout_manager.h" | 14 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 16 #include "ash/common/wm/window_state.h" | 15 #include "ash/common/wm/window_state.h" |
| 17 #include "ash/common/wm/workspace/workspace_window_resizer.h" | 16 #include "ash/common/wm/workspace/workspace_window_resizer.h" |
| 17 #include "ash/common/wm_window.h" |
| 18 #include "ash/public/cpp/shell_window_ids.h" | 18 #include "ash/public/cpp/shell_window_ids.h" |
| 19 #include "ash/screen_util.h" | 19 #include "ash/screen_util.h" |
| 20 #include "ash/shell.h" | 20 #include "ash/shell.h" |
| 21 #include "ash/test/ash_md_test_base.h" | 21 #include "ash/test/ash_md_test_base.h" |
| 22 #include "ash/test/shell_test_api.h" | 22 #include "ash/test/shell_test_api.h" |
| 23 #include "ash/wm/window_state_aura.h" | 23 #include "ash/wm/window_state_aura.h" |
| 24 #include "ash/wm/window_util.h" | 24 #include "ash/wm/window_util.h" |
| 25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 26 #include "ui/aura/client/aura_constants.h" | 26 #include "ui/aura/client/aura_constants.h" |
| 27 #include "ui/aura/test/test_window_delegate.h" | 27 #include "ui/aura/test/test_window_delegate.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 aura::Window* CreatePopupLikeWindow(const gfx::Rect& bounds) { | 114 aura::Window* CreatePopupLikeWindow(const gfx::Rect& bounds) { |
| 115 aura::Window* window = CreateTestWindowInShellWithBounds(bounds); | 115 aura::Window* window = CreateTestWindowInShellWithBounds(bounds); |
| 116 window->Show(); | 116 window->Show(); |
| 117 return window; | 117 return window; |
| 118 } | 118 } |
| 119 | 119 |
| 120 aura::Window* CreateTestPanel(aura::WindowDelegate* delegate, | 120 aura::Window* CreateTestPanel(aura::WindowDelegate* delegate, |
| 121 const gfx::Rect& bounds) { | 121 const gfx::Rect& bounds) { |
| 122 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 122 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
| 123 delegate, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); | 123 delegate, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); |
| 124 WmWindow* wm_window = WmWindowAura::Get(window); | 124 WmWindow* wm_window = WmWindow::Get(window); |
| 125 test::TestShelfDelegate::instance()->AddShelfItem(wm_window); | 125 test::TestShelfDelegate::instance()->AddShelfItem(wm_window); |
| 126 PanelLayoutManager::Get(wm_window)->Relayout(); | 126 PanelLayoutManager::Get(wm_window)->Relayout(); |
| 127 return window; | 127 return window; |
| 128 } | 128 } |
| 129 | 129 |
| 130 aura::Window* GetDesktop() { | 130 aura::Window* GetDesktop() { |
| 131 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 131 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
| 132 kShellWindowId_DefaultContainer); | 132 kShellWindowId_DefaultContainer); |
| 133 } | 133 } |
| 134 | 134 |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 // Auto positioning pushes windows to each sides. | 1052 // Auto positioning pushes windows to each sides. |
| 1053 EXPECT_EQ("0,0 100x100", window1->bounds().ToString()); | 1053 EXPECT_EQ("0,0 100x100", window1->bounds().ToString()); |
| 1054 EXPECT_EQ("300,0 100x100", window2->bounds().ToString()); | 1054 EXPECT_EQ("300,0 100x100", window2->bounds().ToString()); |
| 1055 | 1055 |
| 1056 window2->Hide(); | 1056 window2->Hide(); |
| 1057 // Restores to the center. | 1057 // Restores to the center. |
| 1058 EXPECT_EQ("150,0 100x100", window1->bounds().ToString()); | 1058 EXPECT_EQ("150,0 100x100", window1->bounds().ToString()); |
| 1059 | 1059 |
| 1060 // A user moved the window. | 1060 // A user moved the window. |
| 1061 std::unique_ptr<WindowResizer> resizer( | 1061 std::unique_ptr<WindowResizer> resizer( |
| 1062 CreateWindowResizer(WmWindowAura::Get(window1.get()), gfx::Point(), | 1062 CreateWindowResizer(WmWindow::Get(window1.get()), gfx::Point(), HTCAPTION, |
| 1063 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE) | 1063 aura::client::WINDOW_MOVE_SOURCE_MOUSE) |
| 1064 .release()); | 1064 .release()); |
| 1065 gfx::Point location = resizer->GetInitialLocation(); | 1065 gfx::Point location = resizer->GetInitialLocation(); |
| 1066 location.Offset(-50, 0); | 1066 location.Offset(-50, 0); |
| 1067 resizer->Drag(location, 0); | 1067 resizer->Drag(location, 0); |
| 1068 resizer->CompleteDrag(); | 1068 resizer->CompleteDrag(); |
| 1069 | 1069 |
| 1070 window1_state->set_bounds_changed_by_user(true); | 1070 window1_state->set_bounds_changed_by_user(true); |
| 1071 window1->SetBounds(gfx::Rect(100, 0, 100, 100)); | 1071 window1->SetBounds(gfx::Rect(100, 0, 100, 100)); |
| 1072 | 1072 |
| 1073 window2->Show(); | 1073 window2->Show(); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 ui::EventTimeForNow()); | 1605 ui::EventTimeForNow()); |
| 1606 target = targeter->FindTargetForEvent(root, &touch); | 1606 target = targeter->FindTargetForEvent(root, &touch); |
| 1607 if (points[i].is_target_hit) | 1607 if (points[i].is_target_hit) |
| 1608 EXPECT_EQ(window.get(), target); | 1608 EXPECT_EQ(window.get(), target); |
| 1609 else | 1609 else |
| 1610 EXPECT_NE(window.get(), target); | 1610 EXPECT_NE(window.get(), target); |
| 1611 } | 1611 } |
| 1612 } | 1612 } |
| 1613 | 1613 |
| 1614 } // namespace ash | 1614 } // namespace ash |
| OLD | NEW |