| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/drag_window_resizer.h" | 5 #include "ash/wm/drag_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/display/mouse_cursor_event_filter.h" | 7 #include "ash/display/mouse_cursor_event_filter.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 AshTestBase::SetUp(); | 42 AshTestBase::SetUp(); |
| 43 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); | 43 UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); |
| 44 | 44 |
| 45 aura::Window* root = Shell::GetPrimaryRootWindow(); | 45 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 46 gfx::Rect root_bounds(root->bounds()); | 46 gfx::Rect root_bounds(root->bounds()); |
| 47 EXPECT_EQ(kRootHeight, root_bounds.height()); | 47 EXPECT_EQ(kRootHeight, root_bounds.height()); |
| 48 EXPECT_EQ(800, root_bounds.width()); | 48 EXPECT_EQ(800, root_bounds.width()); |
| 49 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); | 49 Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); |
| 50 window_.reset(new aura::Window(&delegate_)); | 50 window_.reset(new aura::Window(&delegate_)); |
| 51 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 51 window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 52 window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 52 window_->Init(ui::LAYER_NOT_DRAWN); |
| 53 ParentWindowInPrimaryRootWindow(window_.get()); | 53 ParentWindowInPrimaryRootWindow(window_.get()); |
| 54 window_->set_id(1); | 54 window_->set_id(1); |
| 55 | 55 |
| 56 always_on_top_window_.reset(new aura::Window(&delegate2_)); | 56 always_on_top_window_.reset(new aura::Window(&delegate2_)); |
| 57 always_on_top_window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 57 always_on_top_window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 58 always_on_top_window_->SetProperty(aura::client::kAlwaysOnTopKey, true); | 58 always_on_top_window_->SetProperty(aura::client::kAlwaysOnTopKey, true); |
| 59 always_on_top_window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 59 always_on_top_window_->Init(ui::LAYER_NOT_DRAWN); |
| 60 ParentWindowInPrimaryRootWindow(always_on_top_window_.get()); | 60 ParentWindowInPrimaryRootWindow(always_on_top_window_.get()); |
| 61 always_on_top_window_->set_id(2); | 61 always_on_top_window_->set_id(2); |
| 62 | 62 |
| 63 system_modal_window_.reset(new aura::Window(&delegate3_)); | 63 system_modal_window_.reset(new aura::Window(&delegate3_)); |
| 64 system_modal_window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 64 system_modal_window_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 65 system_modal_window_->SetProperty(aura::client::kModalKey, | 65 system_modal_window_->SetProperty(aura::client::kModalKey, |
| 66 ui::MODAL_TYPE_SYSTEM); | 66 ui::MODAL_TYPE_SYSTEM); |
| 67 system_modal_window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 67 system_modal_window_->Init(ui::LAYER_NOT_DRAWN); |
| 68 ParentWindowInPrimaryRootWindow(system_modal_window_.get()); | 68 ParentWindowInPrimaryRootWindow(system_modal_window_.get()); |
| 69 system_modal_window_->set_id(3); | 69 system_modal_window_->set_id(3); |
| 70 | 70 |
| 71 transient_child_ = new aura::Window(&delegate4_); | 71 transient_child_ = new aura::Window(&delegate4_); |
| 72 transient_child_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 72 transient_child_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 73 transient_child_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 73 transient_child_->Init(ui::LAYER_NOT_DRAWN); |
| 74 ParentWindowInPrimaryRootWindow(transient_child_); | 74 ParentWindowInPrimaryRootWindow(transient_child_); |
| 75 transient_child_->set_id(4); | 75 transient_child_->set_id(4); |
| 76 | 76 |
| 77 transient_parent_.reset(new aura::Window(&delegate5_)); | 77 transient_parent_.reset(new aura::Window(&delegate5_)); |
| 78 transient_parent_->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 78 transient_parent_->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 79 transient_parent_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 79 transient_parent_->Init(ui::LAYER_NOT_DRAWN); |
| 80 ParentWindowInPrimaryRootWindow(transient_parent_.get()); | 80 ParentWindowInPrimaryRootWindow(transient_parent_.get()); |
| 81 ::wm::AddTransientChild(transient_parent_.get(), transient_child_); | 81 ::wm::AddTransientChild(transient_parent_.get(), transient_child_); |
| 82 transient_parent_->set_id(5); | 82 transient_parent_->set_id(5); |
| 83 | 83 |
| 84 panel_window_.reset(new aura::Window(&delegate6_)); | 84 panel_window_.reset(new aura::Window(&delegate6_)); |
| 85 panel_window_->SetType(ui::wm::WINDOW_TYPE_PANEL); | 85 panel_window_->SetType(ui::wm::WINDOW_TYPE_PANEL); |
| 86 panel_window_->Init(aura::WINDOW_LAYER_NOT_DRAWN); | 86 panel_window_->Init(ui::LAYER_NOT_DRAWN); |
| 87 ParentWindowInPrimaryRootWindow(panel_window_.get()); | 87 ParentWindowInPrimaryRootWindow(panel_window_.get()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void TearDown() override { | 90 void TearDown() override { |
| 91 window_.reset(); | 91 window_.reset(); |
| 92 always_on_top_window_.reset(); | 92 always_on_top_window_.reset(); |
| 93 system_modal_window_.reset(); | 93 system_modal_window_.reset(); |
| 94 transient_parent_.reset(); | 94 transient_parent_.reset(); |
| 95 panel_window_.reset(); | 95 panel_window_.reset(); |
| 96 AshTestBase::TearDown(); | 96 AshTestBase::TearDown(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 276 |
| 277 // The secondary display is logically on the right, but on the system (e.g. X) | 277 // The secondary display is logically on the right, but on the system (e.g. X) |
| 278 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. | 278 // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. |
| 279 UpdateDisplay("800x600,800x600"); | 279 UpdateDisplay("800x600,800x600"); |
| 280 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 280 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 281 ASSERT_EQ(2U, root_windows.size()); | 281 ASSERT_EQ(2U, root_windows.size()); |
| 282 | 282 |
| 283 aura::test::TestWindowDelegate delegate; | 283 aura::test::TestWindowDelegate delegate; |
| 284 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); | 284 scoped_ptr<aura::Window> window(new aura::Window(&delegate)); |
| 285 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 285 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 286 window->Init(aura::WINDOW_LAYER_TEXTURED); | 286 window->Init(ui::LAYER_TEXTURED); |
| 287 ParentWindowInPrimaryRootWindow(window.get()); | 287 ParentWindowInPrimaryRootWindow(window.get()); |
| 288 window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), | 288 window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), |
| 289 Shell::GetScreen()->GetPrimaryDisplay()); | 289 Shell::GetScreen()->GetPrimaryDisplay()); |
| 290 window->Show(); | 290 window->Show(); |
| 291 EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); | 291 EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); |
| 292 ash::wm::ActivateWindow(window.get()); | 292 ash::wm::ActivateWindow(window.get()); |
| 293 EXPECT_EQ(root_windows[0], window->GetRootWindow()); | 293 EXPECT_EQ(root_windows[0], window->GetRootWindow()); |
| 294 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); | 294 EXPECT_EQ(root_windows[0], ash::Shell::GetTargetRootWindow()); |
| 295 { | 295 { |
| 296 // Grab (0, 0) of the window. | 296 // Grab (0, 0) of the window. |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 window, gfx::Point(), HTCAPTION)); | 627 window, gfx::Point(), HTCAPTION)); |
| 628 ASSERT_TRUE(resizer.get()); | 628 ASSERT_TRUE(resizer.get()); |
| 629 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); | 629 resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); |
| 630 EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0], | 630 EXPECT_TRUE(WarpMouseCursorIfNecessary(root_windows[0], |
| 631 gfx::Point(399, 200))); | 631 gfx::Point(399, 200))); |
| 632 resizer->CompleteDrag(); | 632 resizer->CompleteDrag(); |
| 633 } | 633 } |
| 634 } | 634 } |
| 635 | 635 |
| 636 } // namespace ash | 636 } // namespace ash |
| OLD | NEW |