Chromium Code Reviews| 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( | |
| 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 | |
| 300 // Note that the system modal property must be set on |window| prior to | |
| 301 // calling ParentWindowWithContext(), otherwise it will not be attached | |
| 302 // as a descendant of the modal container window. | |
| 303 window->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM); | |
| 304 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | |
| 305 window->Init(ui::LAYER_TEXTURED); | |
| 306 window->Show(); | |
| 307 | |
| 308 if (bounds.IsEmpty()) { | |
| 309 ParentWindowInPrimaryRootWindow(window); | |
| 310 } else { | |
| 311 gfx::Display display = Shell::GetScreen()->GetDisplayMatching(bounds); | |
| 312 aura::Window* root = ash::Shell::GetInstance() | |
| 313 ->display_controller() | |
| 314 ->GetRootWindowForDisplayId(display.id()); | |
| 315 gfx::Point origin = bounds.origin(); | |
| 316 ::wm::ConvertPointFromScreen(root, &origin); | |
| 317 window->SetBounds(gfx::Rect(origin, bounds.size())); | |
| 318 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
| |
| 319 } | |
| 320 return window; | |
| 321 } | |
| 322 | |
| 287 void AshTestBase::ParentWindowInPrimaryRootWindow(aura::Window* window) { | 323 void AshTestBase::ParentWindowInPrimaryRootWindow(aura::Window* window) { |
| 288 aura::client::ParentWindowWithContext( | 324 aura::client::ParentWindowWithContext( |
| 289 window, Shell::GetPrimaryRootWindow(), gfx::Rect()); | 325 window, Shell::GetPrimaryRootWindow(), gfx::Rect()); |
| 290 } | 326 } |
| 291 | 327 |
| 292 void AshTestBase::RunAllPendingInMessageLoop() { | 328 void AshTestBase::RunAllPendingInMessageLoop() { |
| 293 ash_test_helper_->RunAllPendingInMessageLoop(); | 329 ash_test_helper_->RunAllPendingInMessageLoop(); |
| 294 } | 330 } |
| 295 | 331 |
| 296 TestScreenshotDelegate* AshTestBase::GetScreenshotDelegate() { | 332 TestScreenshotDelegate* AshTestBase::GetScreenshotDelegate() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 356 | 392 |
| 357 void AshTestBase::UnblockUserSession() { | 393 void AshTestBase::UnblockUserSession() { |
| 358 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); | 394 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); |
| 359 SetSessionStarted(true); | 395 SetSessionStarted(true); |
| 360 SetUserAddingScreenRunning(false); | 396 SetUserAddingScreenRunning(false); |
| 361 } | 397 } |
| 362 | 398 |
| 363 | 399 |
| 364 } // namespace test | 400 } // namespace test |
| 365 } // namespace ash | 401 } // namespace ash |
| OLD | NEW |