Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/dock/docked_window_resizer.h" | 5 #include "ash/wm/dock/docked_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 test::TestShelfDelegate* shelf_delegate = | 80 test::TestShelfDelegate* shelf_delegate = |
| 81 test::TestShelfDelegate::instance(); | 81 test::TestShelfDelegate::instance(); |
| 82 shelf_delegate->AddShelfItem(window); | 82 shelf_delegate->AddShelfItem(window); |
| 83 PanelLayoutManager* manager = static_cast<PanelLayoutManager*>( | 83 PanelLayoutManager* manager = static_cast<PanelLayoutManager*>( |
| 84 Shell::GetContainer(window->GetRootWindow(), | 84 Shell::GetContainer(window->GetRootWindow(), |
| 85 kShellWindowId_PanelContainer)->layout_manager()); | 85 kShellWindowId_PanelContainer)->layout_manager()); |
| 86 manager->Relayout(); | 86 manager->Relayout(); |
| 87 } | 87 } |
| 88 return window; | 88 return window; |
| 89 } | 89 } |
| 90 | |
| 91 aura::Window* CreateModalWindow(const gfx::Rect& bounds) { | 90 aura::Window* CreateModalWindow(const gfx::Rect& bounds) { |
| 92 aura::Window* window = new aura::Window(&delegate_); | 91 return CreateTestModalWindowInShellWithDelegateAndType( |
| 93 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); | 92 &delegate_, ui::wm::WINDOW_TYPE_NORMAL, 0, bounds); |
|
jonross
2015/05/01 17:30:15
Awesome!
| |
| 94 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | |
| 95 window->Init(ui::LAYER_TEXTURED); | |
| 96 window->Show(); | |
| 97 | |
| 98 if (bounds.IsEmpty()) { | |
| 99 ParentWindowInPrimaryRootWindow(window); | |
| 100 } else { | |
| 101 gfx::Display display = | |
| 102 Shell::GetScreen()->GetDisplayMatching(bounds); | |
| 103 aura::Window* root = ash::Shell::GetInstance()->display_controller()-> | |
| 104 GetRootWindowForDisplayId(display.id()); | |
| 105 gfx::Point origin = bounds.origin(); | |
| 106 ::wm::ConvertPointFromScreen(root, &origin); | |
| 107 window->SetBounds(gfx::Rect(origin, bounds.size())); | |
| 108 aura::client::ParentWindowWithContext(window, root, bounds); | |
| 109 } | |
| 110 return window; | |
| 111 } | 93 } |
| 112 | 94 |
| 113 static WindowResizer* CreateSomeWindowResizer( | 95 static WindowResizer* CreateSomeWindowResizer( |
| 114 aura::Window* window, | 96 aura::Window* window, |
| 115 const gfx::Point& point_in_parent, | 97 const gfx::Point& point_in_parent, |
| 116 int window_component) { | 98 int window_component) { |
| 117 return CreateWindowResizer( | 99 return CreateWindowResizer( |
| 118 window, | 100 window, |
| 119 point_in_parent, | 101 point_in_parent, |
| 120 window_component, | 102 window_component, |
| (...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1602 EXPECT_TRUE(window_state->IsMaximized()); | 1584 EXPECT_TRUE(window_state->IsMaximized()); |
| 1603 } | 1585 } |
| 1604 | 1586 |
| 1605 // Tests run twice - on both panels and normal windows | 1587 // Tests run twice - on both panels and normal windows |
| 1606 INSTANTIATE_TEST_CASE_P(NormalOrPanel, | 1588 INSTANTIATE_TEST_CASE_P(NormalOrPanel, |
| 1607 DockedWindowResizerTest, | 1589 DockedWindowResizerTest, |
| 1608 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, | 1590 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, |
| 1609 ui::wm::WINDOW_TYPE_PANEL)); | 1591 ui::wm::WINDOW_TYPE_PANEL)); |
| 1610 | 1592 |
| 1611 } // namespace ash | 1593 } // namespace ash |
| OLD | NEW |