| 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/wm/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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" |
| 28 #include "ui/aura/test/test_windows.h" | 28 #include "ui/aura/test/test_windows.h" |
| 29 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 30 #include "ui/aura/window_event_dispatcher.h" | 30 #include "ui/aura/window_event_dispatcher.h" |
| 31 #include "ui/base/hit_test.h" | 31 #include "ui/base/hit_test.h" |
| 32 #include "ui/base/ui_base_types.h" | 32 #include "ui/base/ui_base_types.h" |
| 33 #include "ui/compositor/layer.h" | 33 #include "ui/compositor/layer.h" |
| 34 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 34 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 35 #include "ui/display/screen.h" |
| 35 #include "ui/events/event_utils.h" | 36 #include "ui/events/event_utils.h" |
| 36 #include "ui/events/test/event_generator.h" | 37 #include "ui/events/test/event_generator.h" |
| 37 #include "ui/gfx/screen.h" | |
| 38 #include "ui/views/widget/widget.h" | 38 #include "ui/views/widget/widget.h" |
| 39 #include "ui/wm/core/window_animations.h" | 39 #include "ui/wm/core/window_animations.h" |
| 40 #include "ui/wm/core/window_util.h" | 40 #include "ui/wm/core/window_util.h" |
| 41 | 41 |
| 42 using aura::Window; | 42 using aura::Window; |
| 43 | 43 |
| 44 namespace ash { | 44 namespace ash { |
| 45 | 45 |
| 46 // Returns a string containing the names of all the children of |window| (in | 46 // Returns a string containing the names of all the children of |window| (in |
| 47 // order). Each entry is separated by a space. | 47 // order). Each entry is separated by a space. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 manager->Relayout(); | 133 manager->Relayout(); |
| 134 return window; | 134 return window; |
| 135 } | 135 } |
| 136 | 136 |
| 137 aura::Window* GetDesktop() { | 137 aura::Window* GetDesktop() { |
| 138 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), | 138 return Shell::GetContainer(Shell::GetPrimaryRootWindow(), |
| 139 kShellWindowId_DefaultContainer); | 139 kShellWindowId_DefaultContainer); |
| 140 } | 140 } |
| 141 | 141 |
| 142 gfx::Rect GetFullscreenBounds(aura::Window* window) { | 142 gfx::Rect GetFullscreenBounds(aura::Window* window) { |
| 143 return gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); | 143 return display::Screen::GetScreen() |
| 144 ->GetDisplayNearestWindow(window) |
| 145 .bounds(); |
| 144 } | 146 } |
| 145 | 147 |
| 146 ShelfWidget* shelf_widget() { | 148 ShelfWidget* shelf_widget() { |
| 147 return Shell::GetPrimaryRootWindowController()->shelf(); | 149 return Shell::GetPrimaryRootWindowController()->shelf(); |
| 148 } | 150 } |
| 149 | 151 |
| 150 ShelfLayoutManager* shelf_layout_manager() { | 152 ShelfLayoutManager* shelf_layout_manager() { |
| 151 return Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | 153 return Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); |
| 152 } | 154 } |
| 153 | 155 |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 // Create another window and maximize it. | 623 // Create another window and maximize it. |
| 622 std::unique_ptr<Window> w2(CreateTestWindow()); | 624 std::unique_ptr<Window> w2(CreateTestWindow()); |
| 623 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); | 625 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 624 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 626 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 625 w2->Show(); | 627 w2->Show(); |
| 626 wm::ActivateWindow(w2.get()); | 628 wm::ActivateWindow(w2.get()); |
| 627 | 629 |
| 628 // Increase the size of the WorkAreaInsets. This would make |w1| fall | 630 // Increase the size of the WorkAreaInsets. This would make |w1| fall |
| 629 // completely out of the display work area. | 631 // completely out of the display work area. |
| 630 gfx::Insets insets = | 632 gfx::Insets insets = |
| 631 gfx::Screen::GetScreen()->GetPrimaryDisplay().GetWorkAreaInsets(); | 633 display::Screen::GetScreen()->GetPrimaryDisplay().GetWorkAreaInsets(); |
| 632 insets.Set(0, 0, insets.bottom() + 30, 0); | 634 insets.Set(0, 0, insets.bottom() + 30, 0); |
| 633 Shell::GetInstance()->SetDisplayWorkAreaInsets(w1.get(), insets); | 635 Shell::GetInstance()->SetDisplayWorkAreaInsets(w1.get(), insets); |
| 634 | 636 |
| 635 // Switch to w1. The window should have moved. | 637 // Switch to w1. The window should have moved. |
| 636 wm::ActivateWindow(w1.get()); | 638 wm::ActivateWindow(w1.get()); |
| 637 EXPECT_NE(w1_bounds.ToString(), w1->bounds().ToString()); | 639 EXPECT_NE(w1_bounds.ToString(), w1->bounds().ToString()); |
| 638 } | 640 } |
| 639 | 641 |
| 640 namespace { | 642 namespace { |
| 641 | 643 |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 ui::EventTimeForNow()); | 1611 ui::EventTimeForNow()); |
| 1610 target = targeter->FindTargetForEvent(root, &touch); | 1612 target = targeter->FindTargetForEvent(root, &touch); |
| 1611 if (points[i].is_target_hit) | 1613 if (points[i].is_target_hit) |
| 1612 EXPECT_EQ(window.get(), target); | 1614 EXPECT_EQ(window.get(), target); |
| 1613 else | 1615 else |
| 1614 EXPECT_NE(window.get(), target); | 1616 EXPECT_NE(window.get(), target); |
| 1615 } | 1617 } |
| 1616 } | 1618 } |
| 1617 | 1619 |
| 1618 } // namespace ash | 1620 } // namespace ash |
| OLD | NEW |