| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "ash/common/accessibility_delegate.h" | 8 #include "ash/common/accessibility_delegate.h" |
| 9 #include "ash/common/accessibility_types.h" | 9 #include "ash/common/accessibility_types.h" |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 11 #include "ash/common/shelf/shelf_widget.h" | 11 #include "ash/common/shelf/shelf_widget.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
| 13 #include "ash/common/system/tray/system_tray.h" | 13 #include "ash/common/system/tray/system_tray.h" |
| 14 #include "ash/common/test/test_shelf_delegate.h" | 14 #include "ash/common/test/test_shelf_delegate.h" |
| 15 #include "ash/common/wm/dock/docked_window_layout_manager.h" | 15 #include "ash/common/wm/dock/docked_window_layout_manager.h" |
| 16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 16 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 17 #include "ash/common/wm/mru_window_tracker.h" | 17 #include "ash/common/wm/mru_window_tracker.h" |
| 18 #include "ash/common/wm/overview/scoped_transform_overview_window.h" | 18 #include "ash/common/wm/overview/scoped_transform_overview_window.h" |
| 19 #include "ash/common/wm/overview/window_grid.h" | 19 #include "ash/common/wm/overview/window_grid.h" |
| 20 #include "ash/common/wm/overview/window_selector.h" | 20 #include "ash/common/wm/overview/window_selector.h" |
| 21 #include "ash/common/wm/overview/window_selector_controller.h" | 21 #include "ash/common/wm/overview/window_selector_controller.h" |
| 22 #include "ash/common/wm/overview/window_selector_item.h" | 22 #include "ash/common/wm/overview/window_selector_item.h" |
| 23 #include "ash/common/wm/panels/panel_layout_manager.h" | 23 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 24 #include "ash/common/wm/window_state.h" | 24 #include "ash/common/wm/window_state.h" |
| 25 #include "ash/common/wm/wm_event.h" | 25 #include "ash/common/wm/wm_event.h" |
| 26 #include "ash/common/wm/workspace/workspace_window_resizer.h" | 26 #include "ash/common/wm/workspace/workspace_window_resizer.h" |
| 27 #include "ash/common/wm_shell.h" | 27 #include "ash/common/wm_shell.h" |
| 28 #include "ash/common/wm_window.h" | 28 #include "ash/common/wm_window.h" |
| 29 #include "ash/common/wm_window_property.h" | |
| 30 #include "ash/drag_drop/drag_drop_controller.h" | 29 #include "ash/drag_drop/drag_drop_controller.h" |
| 31 #include "ash/public/cpp/shell_window_ids.h" | 30 #include "ash/public/cpp/shell_window_ids.h" |
| 32 #include "ash/root_window_controller.h" | 31 #include "ash/root_window_controller.h" |
| 33 #include "ash/shell.h" | 32 #include "ash/shell.h" |
| 34 #include "ash/test/ash_test_base.h" | 33 #include "ash/test/ash_test_base.h" |
| 35 #include "ash/test/shelf_view_test_api.h" | 34 #include "ash/test/shelf_view_test_api.h" |
| 36 #include "ash/test/shell_test_api.h" | 35 #include "ash/test/shell_test_api.h" |
| 37 #include "ash/test/test_app_list_view_presenter_impl.h" | 36 #include "ash/test/test_app_list_view_presenter_impl.h" |
| 38 #include "ash/wm/window_state_aura.h" | 37 #include "ash/wm/window_state_aura.h" |
| 39 #include "ash/wm/window_util.h" | 38 #include "ash/wm/window_util.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // views::Widget::GetWidgetForNativeView(window)->Close(). | 152 // views::Widget::GetWidgetForNativeView(window)->Close(). |
| 154 std::unique_ptr<views::Widget> CreateWindowWidget(const gfx::Rect& bounds) { | 153 std::unique_ptr<views::Widget> CreateWindowWidget(const gfx::Rect& bounds) { |
| 155 std::unique_ptr<views::Widget> widget(new views::Widget); | 154 std::unique_ptr<views::Widget> widget(new views::Widget); |
| 156 views::Widget::InitParams params; | 155 views::Widget::InitParams params; |
| 157 params.bounds = bounds; | 156 params.bounds = bounds; |
| 158 params.type = views::Widget::InitParams::TYPE_WINDOW; | 157 params.type = views::Widget::InitParams::TYPE_WINDOW; |
| 159 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 158 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 160 widget->Init(params); | 159 widget->Init(params); |
| 161 widget->Show(); | 160 widget->Show(); |
| 162 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); | 161 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); |
| 163 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight); | 162 window->aura_window()->SetProperty(aura::client::kTopViewInset, |
| 163 kHeaderHeight); |
| 164 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow()); | 164 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow()); |
| 165 return widget; | 165 return widget; |
| 166 } | 166 } |
| 167 | 167 |
| 168 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { | 168 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { |
| 169 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 169 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
| 170 nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); | 170 nullptr, ui::wm::WINDOW_TYPE_PANEL, 0, bounds); |
| 171 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); | 171 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); |
| 172 test::TestShelfDelegate::instance()->AddShelfItem(WmWindow::Get(window)); | 172 test::TestShelfDelegate::instance()->AddShelfItem(WmWindow::Get(window)); |
| 173 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); | 173 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 // closed or not. We explicity create the widget so that the window can be | 1123 // closed or not. We explicity create the widget so that the window can be |
| 1124 // parented to a non-primary root window. | 1124 // parented to a non-primary root window. |
| 1125 std::unique_ptr<views::Widget> widget(new views::Widget); | 1125 std::unique_ptr<views::Widget> widget(new views::Widget); |
| 1126 views::Widget::InitParams params; | 1126 views::Widget::InitParams params; |
| 1127 params.bounds = gfx::Rect(650, 0, 400, 400); | 1127 params.bounds = gfx::Rect(650, 0, 400, 400); |
| 1128 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 1128 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 1129 params.parent = window1->parent(); | 1129 params.parent = window1->parent(); |
| 1130 widget->Init(params); | 1130 widget->Init(params); |
| 1131 widget->Show(); | 1131 widget->Show(); |
| 1132 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); | 1132 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); |
| 1133 window->SetIntProperty(WmWindowProperty::TOP_VIEW_INSET, kHeaderHeight); | 1133 window->aura_window()->SetProperty(aura::client::kTopViewInset, |
| 1134 kHeaderHeight); |
| 1134 | 1135 |
| 1135 ASSERT_EQ(root_windows[1], window1->GetRootWindow()); | 1136 ASSERT_EQ(root_windows[1], window1->GetRootWindow()); |
| 1136 | 1137 |
| 1137 ToggleOverview(); | 1138 ToggleOverview(); |
| 1138 | 1139 |
| 1139 aura::Window* window2 = widget->GetNativeWindow(); | 1140 aura::Window* window2 = widget->GetNativeWindow(); |
| 1140 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window2); | 1141 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window2); |
| 1141 gfx::Point point(bounds.top_right().x() - 1, bounds.top_right().y() + 5); | 1142 gfx::Point point(bounds.top_right().x() - 1, bounds.top_right().y() + 5); |
| 1142 ui::test::EventGenerator event_generator(window2->GetRootWindow(), point); | 1143 ui::test::EventGenerator event_generator(window2->GetRootWindow(), point); |
| 1143 | 1144 |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); | 2134 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); |
| 2134 ASSERT_TRUE(resizer.get()); | 2135 ASSERT_TRUE(resizer.get()); |
| 2135 gfx::Point location = resizer->GetInitialLocation(); | 2136 gfx::Point location = resizer->GetInitialLocation(); |
| 2136 location.Offset(20, 20); | 2137 location.Offset(20, 20); |
| 2137 resizer->Drag(location, 0); | 2138 resizer->Drag(location, 0); |
| 2138 ToggleOverview(); | 2139 ToggleOverview(); |
| 2139 resizer->RevertDrag(); | 2140 resizer->RevertDrag(); |
| 2140 } | 2141 } |
| 2141 | 2142 |
| 2142 } // namespace ash | 2143 } // namespace ash |
| OLD | NEW |