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..5cb2829b58cb6a9b7ee9ee3d7b7bb48dbd21a71c 100644 |
| --- a/ash/test/ash_test_base.cc |
| +++ b/ash/test/ash_test_base.cc |
| @@ -284,6 +284,38 @@ 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( |
|
jonross
2015/05/01 17:30:15
Can you call CreateTestWindowInShellWithDelegateAn
tdanderson
2015/05/01 18:07:32
I tried that but it doesn't work. The system modal
jonross
2015/05/01 18:29:53
Acknowledged.
|
| + aura::WindowDelegate* delegate, |
| + ui::wm::WindowType type, |
| + int id, |
| + const gfx::Rect& bounds) { |
| + aura::Window* window = new aura::Window(delegate); |
| + 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); |
| + } |
| + return window; |
| +} |
| + |
| void AshTestBase::ParentWindowInPrimaryRootWindow(aura::Window* window) { |
| aura::client::ParentWindowWithContext( |
| window, Shell::GetPrimaryRootWindow(), gfx::Rect()); |