Chromium Code Reviews| Index: ash/test/ash_test_base.cc |
| diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc |
| index ffb633060175ed876faa1c937714d505b0de8441..21f8c602a5dd13d051f859717416d1ec0942ffef 100644 |
| --- a/ash/test/ash_test_base.cc |
| +++ b/ash/test/ash_test_base.cc |
| @@ -284,6 +284,42 @@ aura::Window* AshTestBase::CreateTestWindowInShellWithDelegateAndType( |
| return window; |
| } |
| +aura::Window* AshTestBase::CreateTestModalWindowInShellWithBounds( |
| + const gfx::Rect& bounds) { |
| + return CreateTestModalWindowInShellWithDelegateAndType( |
| + nullptr, ui::wm::WINDOW_TYPE_NORMAL, 0, bounds); |
| +} |
| + |
| +aura::Window* AshTestBase::CreateTestModalWindowInShellWithDelegateAndType( |
| + aura::WindowDelegate* delegate, |
| + ui::wm::WindowType type, |
| + int id, |
| + const gfx::Rect& bounds) { |
| + aura::Window* window = new aura::Window(delegate); |
| + |
| + // Note that the system modal property must be set on |window| prior to |
| + // calling ParentWindowWithContext(), otherwise it will not be attached |
| + // as a descendant of the modal container window. |
| + window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); |
| + window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| + window->Init(ui::LAYER_TEXTURED); |
| + window->Show(); |
| + |
| + if (bounds.IsEmpty()) { |
| + ParentWindowInPrimaryRootWindow(window); |
| + } else { |
| + gfx::Display display = Shell::GetScreen()->GetDisplayMatching(bounds); |
| + aura::Window* root = ash::Shell::GetInstance() |
| + ->display_controller() |
| + ->GetRootWindowForDisplayId(display.id()); |
| + gfx::Point origin = bounds.origin(); |
| + ::wm::ConvertPointFromScreen(root, &origin); |
| + window->SetBounds(gfx::Rect(origin, bounds.size())); |
| + aura::client::ParentWindowWithContext(window, root, bounds); |
|
oshima
2015/05/04 19:35:36
Window::SetBoundsInScreen ?
tdanderson
2015/05/06 16:36:05
I think SetBounds() here is correct - it's consist
|
| + } |
| + return window; |
| +} |
| + |
| void AshTestBase::ParentWindowInPrimaryRootWindow(aura::Window* window) { |
| aura::client::ParentWindowWithContext( |
| window, Shell::GetPrimaryRootWindow(), gfx::Rect()); |