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/test/ash_test_base.h" | 5 #include "ash/test/ash_test_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 gfx::Point origin = bounds.origin(); | 277 gfx::Point origin = bounds.origin(); |
278 ::wm::ConvertPointFromScreen(root, &origin); | 278 ::wm::ConvertPointFromScreen(root, &origin); |
279 window->SetBounds(gfx::Rect(origin, bounds.size())); | 279 window->SetBounds(gfx::Rect(origin, bounds.size())); |
280 aura::client::ParentWindowWithContext(window, root, bounds); | 280 aura::client::ParentWindowWithContext(window, root, bounds); |
281 } | 281 } |
282 window->SetProperty(aura::client::kCanMaximizeKey, true); | 282 window->SetProperty(aura::client::kCanMaximizeKey, true); |
283 window->SetProperty(aura::client::kCanMinimizeKey, true); | 283 window->SetProperty(aura::client::kCanMinimizeKey, true); |
284 return window; | 284 return window; |
285 } | 285 } |
286 | 286 |
287 aura::Window* AshTestBase::CreateTestModalWindowInShellWithBounds( | |
288 const gfx::Rect& bounds) { | |
289 return CreateTestModalWindowInShellWithDelegateAndType( | |
290 nullptr, ui::wm::WINDOW_TYPE_NORMAL, 0, bounds); | |
291 } | |
292 | |
293 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.
| |
294 aura::WindowDelegate* delegate, | |
295 ui::wm::WindowType type, | |
296 int id, | |
297 const gfx::Rect& bounds) { | |
298 aura::Window* window = new aura::Window(delegate); | |
299 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); | |
300 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | |
301 window->Init(ui::LAYER_TEXTURED); | |
302 window->Show(); | |
303 | |
304 if (bounds.IsEmpty()) { | |
305 ParentWindowInPrimaryRootWindow(window); | |
306 } else { | |
307 gfx::Display display = Shell::GetScreen()->GetDisplayMatching(bounds); | |
308 aura::Window* root = ash::Shell::GetInstance() | |
309 ->display_controller() | |
310 ->GetRootWindowForDisplayId(display.id()); | |
311 gfx::Point origin = bounds.origin(); | |
312 ::wm::ConvertPointFromScreen(root, &origin); | |
313 window->SetBounds(gfx::Rect(origin, bounds.size())); | |
314 aura::client::ParentWindowWithContext(window, root, bounds); | |
315 } | |
316 return window; | |
317 } | |
318 | |
287 void AshTestBase::ParentWindowInPrimaryRootWindow(aura::Window* window) { | 319 void AshTestBase::ParentWindowInPrimaryRootWindow(aura::Window* window) { |
288 aura::client::ParentWindowWithContext( | 320 aura::client::ParentWindowWithContext( |
289 window, Shell::GetPrimaryRootWindow(), gfx::Rect()); | 321 window, Shell::GetPrimaryRootWindow(), gfx::Rect()); |
290 } | 322 } |
291 | 323 |
292 void AshTestBase::RunAllPendingInMessageLoop() { | 324 void AshTestBase::RunAllPendingInMessageLoop() { |
293 ash_test_helper_->RunAllPendingInMessageLoop(); | 325 ash_test_helper_->RunAllPendingInMessageLoop(); |
294 } | 326 } |
295 | 327 |
296 TestScreenshotDelegate* AshTestBase::GetScreenshotDelegate() { | 328 TestScreenshotDelegate* AshTestBase::GetScreenshotDelegate() { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 | 388 |
357 void AshTestBase::UnblockUserSession() { | 389 void AshTestBase::UnblockUserSession() { |
358 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); | 390 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); |
359 SetSessionStarted(true); | 391 SetSessionStarted(true); |
360 SetUserAddingScreenRunning(false); | 392 SetUserAddingScreenRunning(false); |
361 } | 393 } |
362 | 394 |
363 | 395 |
364 } // namespace test | 396 } // namespace test |
365 } // namespace ash | 397 } // namespace ash |
OLD | NEW |