Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: ash/test/ash_test_base.cc

Issue 1114383002: Show overview mode button in TouchView with open modal window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/test/ash_test_base.h ('k') | ash/wm/dock/docked_window_resizer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « ash/test/ash_test_base.h ('k') | ash/wm/dock/docked_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698