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/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
9 #include "ash/accessibility_types.h" | 9 #include "ash/accessibility_types.h" |
10 #include "ash/drag_drop/drag_drop_controller.h" | 10 #include "ash/drag_drop/drag_drop_controller.h" |
11 #include "ash/public/cpp/config.h" | 11 #include "ash/public/cpp/config.h" |
12 #include "ash/public/cpp/window_properties.h" | 12 #include "ash/public/cpp/window_properties.h" |
13 #include "ash/shelf/shelf.h" | 13 #include "ash/shelf/shelf.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/system/tray/system_tray.h" | 15 #include "ash/system/tray/system_tray.h" |
16 #include "ash/test/ash_test_base.h" | 16 #include "ash/test/ash_test_base.h" |
17 #include "ash/test/shelf_view_test_api.h" | 17 #include "ash/test/shelf_view_test_api.h" |
18 #include "ash/test/shell_test_api.h" | 18 #include "ash/test/shell_test_api.h" |
19 #include "ash/test/test_app_list_view_presenter_impl.h" | 19 #include "ash/test/test_app_list_view_presenter_impl.h" |
20 #include "ash/wm/overview/window_grid.h" | 20 #include "ash/wm/overview/window_grid.h" |
21 #include "ash/wm/overview/window_selector.h" | 21 #include "ash/wm/overview/window_selector.h" |
22 #include "ash/wm/overview/window_selector_controller.h" | 22 #include "ash/wm/overview/window_selector_controller.h" |
23 #include "ash/wm/overview/window_selector_item.h" | 23 #include "ash/wm/overview/window_selector_item.h" |
24 #include "ash/wm/panels/panel_layout_manager.h" | 24 #include "ash/wm/panels/panel_layout_manager.h" |
25 #include "ash/wm/tablet_mode/tablet_mode_controller.h" | 25 #include "ash/wm/tablet_mode/tablet_mode_controller.h" |
26 #include "ash/wm/window_state.h" | 26 #include "ash/wm/window_state.h" |
27 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
28 #include "ash/wm/wm_event.h" | 28 #include "ash/wm/wm_event.h" |
29 #include "ash/wm/workspace/workspace_window_resizer.h" | 29 #include "ash/wm/workspace/workspace_window_resizer.h" |
30 #include "ash/wm_window.h" | |
31 #include "base/strings/string_number_conversions.h" | 30 #include "base/strings/string_number_conversions.h" |
32 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
33 #include "base/test/user_action_tester.h" | 32 #include "base/test/user_action_tester.h" |
34 #include "ui/aura/client/aura_constants.h" | 33 #include "ui/aura/client/aura_constants.h" |
35 #include "ui/aura/client/focus_client.h" | 34 #include "ui/aura/client/focus_client.h" |
36 #include "ui/aura/test/test_windows.h" | 35 #include "ui/aura/test/test_windows.h" |
37 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
38 #include "ui/base/hit_test.h" | 37 #include "ui/base/hit_test.h" |
39 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 38 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
40 #include "ui/display/display_layout.h" | 39 #include "ui/display/display_layout.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // cause a window to be closed via | 128 // cause a window to be closed via |
130 // views::Widget::GetWidgetForNativeView(window)->Close(). | 129 // views::Widget::GetWidgetForNativeView(window)->Close(). |
131 std::unique_ptr<views::Widget> CreateWindowWidget(const gfx::Rect& bounds) { | 130 std::unique_ptr<views::Widget> CreateWindowWidget(const gfx::Rect& bounds) { |
132 std::unique_ptr<views::Widget> widget(new views::Widget); | 131 std::unique_ptr<views::Widget> widget(new views::Widget); |
133 views::Widget::InitParams params; | 132 views::Widget::InitParams params; |
134 params.bounds = bounds; | 133 params.bounds = bounds; |
135 params.type = views::Widget::InitParams::TYPE_WINDOW; | 134 params.type = views::Widget::InitParams::TYPE_WINDOW; |
136 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 135 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
137 widget->Init(params); | 136 widget->Init(params); |
138 widget->Show(); | 137 widget->Show(); |
139 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); | 138 aura::Window* window = widget->GetNativeWindow(); |
140 window->aura_window()->SetProperty(aura::client::kTopViewInset, | 139 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); |
141 kHeaderHeight); | 140 ParentWindowInPrimaryRootWindow(window); |
142 ParentWindowInPrimaryRootWindow(widget->GetNativeWindow()); | |
143 return widget; | 141 return widget; |
144 } | 142 } |
145 | 143 |
146 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { | 144 aura::Window* CreatePanelWindow(const gfx::Rect& bounds) { |
147 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( | 145 aura::Window* window = CreateTestWindowInShellWithDelegateAndType( |
148 nullptr, aura::client::WINDOW_TYPE_PANEL, 0, bounds); | 146 nullptr, aura::client::WINDOW_TYPE_PANEL, 0, bounds); |
149 static int id = 0; | 147 static int id = 0; |
150 std::string shelf_id(ShelfID(base::IntToString(id++)).Serialize()); | 148 std::string shelf_id(ShelfID(base::IntToString(id++)).Serialize()); |
151 window->SetProperty(kShelfIDKey, new std::string(shelf_id)); | 149 window->SetProperty(kShelfIDKey, new std::string(shelf_id)); |
152 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); | 150 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 // via the widget. We also use the widget to determine if the window has been | 825 // via the widget. We also use the widget to determine if the window has been |
828 // closed or not. We explicity create the widget so that the window can be | 826 // closed or not. We explicity create the widget so that the window can be |
829 // parented to a non-primary root window. | 827 // parented to a non-primary root window. |
830 std::unique_ptr<views::Widget> widget(new views::Widget); | 828 std::unique_ptr<views::Widget> widget(new views::Widget); |
831 views::Widget::InitParams params; | 829 views::Widget::InitParams params; |
832 params.bounds = gfx::Rect(650, 0, 400, 400); | 830 params.bounds = gfx::Rect(650, 0, 400, 400); |
833 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 831 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
834 params.parent = window1->parent(); | 832 params.parent = window1->parent(); |
835 widget->Init(params); | 833 widget->Init(params); |
836 widget->Show(); | 834 widget->Show(); |
837 WmWindow* window = WmWindow::Get(widget->GetNativeWindow()); | 835 aura::Window* window = widget->GetNativeWindow(); |
838 window->aura_window()->SetProperty(aura::client::kTopViewInset, | 836 window->SetProperty(aura::client::kTopViewInset, kHeaderHeight); |
839 kHeaderHeight); | |
840 | 837 |
841 ASSERT_EQ(root_windows[1], window1->GetRootWindow()); | 838 ASSERT_EQ(root_windows[1], window1->GetRootWindow()); |
842 | 839 |
843 ToggleOverview(); | 840 ToggleOverview(); |
844 | 841 |
845 aura::Window* window2 = widget->GetNativeWindow(); | 842 aura::Window* window2 = widget->GetNativeWindow(); |
846 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window2); | 843 gfx::Rect bounds = GetTransformedBoundsInRootWindow(window2); |
847 gfx::Point point(bounds.top_right().x() - 1, bounds.top_right().y() + 5); | 844 gfx::Point point(bounds.top_right().x() - 1, bounds.top_right().y() + 5); |
848 ui::test::EventGenerator event_generator(window2->GetRootWindow(), point); | 845 ui::test::EventGenerator event_generator(window2->GetRootWindow(), point); |
849 | 846 |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); | 1847 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); |
1851 ASSERT_TRUE(resizer.get()); | 1848 ASSERT_TRUE(resizer.get()); |
1852 gfx::Point location = resizer->GetInitialLocation(); | 1849 gfx::Point location = resizer->GetInitialLocation(); |
1853 location.Offset(20, 20); | 1850 location.Offset(20, 20); |
1854 resizer->Drag(location, 0); | 1851 resizer->Drag(location, 0); |
1855 ToggleOverview(); | 1852 ToggleOverview(); |
1856 resizer->RevertDrag(); | 1853 resizer->RevertDrag(); |
1857 } | 1854 } |
1858 | 1855 |
1859 } // namespace ash | 1856 } // namespace ash |
OLD | NEW |