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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 class AshEventGeneratorDelegate | 55 class AshEventGeneratorDelegate |
56 : public aura::test::EventGeneratorDelegateAura { | 56 : public aura::test::EventGeneratorDelegateAura { |
57 public: | 57 public: |
58 AshEventGeneratorDelegate() {} | 58 AshEventGeneratorDelegate() {} |
59 ~AshEventGeneratorDelegate() override {} | 59 ~AshEventGeneratorDelegate() override {} |
60 | 60 |
61 // aura::test::EventGeneratorDelegateAura overrides: | 61 // aura::test::EventGeneratorDelegateAura overrides: |
62 aura::WindowTreeHost* GetHostAt( | 62 aura::WindowTreeHost* GetHostAt( |
63 const gfx::Point& point_in_screen) const override { | 63 const gfx::Point& point_in_screen) const override { |
64 gfx::Screen* screen = Shell::GetScreen(); | 64 gfx::Screen* screen = gfx::Screen::GetScreen(); |
65 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); | 65 gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); |
66 return Shell::GetInstance() | 66 return Shell::GetInstance() |
67 ->window_tree_host_manager() | 67 ->window_tree_host_manager() |
68 ->GetRootWindowForDisplayId(display.id()) | 68 ->GetRootWindowForDisplayId(display.id()) |
69 ->GetHost(); | 69 ->GetHost(); |
70 } | 70 } |
71 | 71 |
72 aura::client::ScreenPositionClient* GetScreenPositionClient( | 72 aura::client::ScreenPositionClient* GetScreenPositionClient( |
73 const aura::Window* window) const override { | 73 const aura::Window* window) const override { |
74 return aura::client::GetScreenPositionClient(window->GetRootWindow()); | 74 return aura::client::GetScreenPositionClient(window->GetRootWindow()); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 const gfx::Rect& bounds) { | 237 const gfx::Rect& bounds) { |
238 aura::Window* window = new aura::Window(delegate); | 238 aura::Window* window = new aura::Window(delegate); |
239 window->set_id(id); | 239 window->set_id(id); |
240 window->SetType(type); | 240 window->SetType(type); |
241 window->Init(ui::LAYER_TEXTURED); | 241 window->Init(ui::LAYER_TEXTURED); |
242 window->Show(); | 242 window->Show(); |
243 | 243 |
244 if (bounds.IsEmpty()) { | 244 if (bounds.IsEmpty()) { |
245 ParentWindowInPrimaryRootWindow(window); | 245 ParentWindowInPrimaryRootWindow(window); |
246 } else { | 246 } else { |
247 gfx::Display display = | 247 gfx::Display display = gfx::Screen::GetScreen()->GetDisplayMatching(bounds); |
248 Shell::GetScreen()->GetDisplayMatching(bounds); | |
249 aura::Window* root = ash::Shell::GetInstance() | 248 aura::Window* root = ash::Shell::GetInstance() |
250 ->window_tree_host_manager() | 249 ->window_tree_host_manager() |
251 ->GetRootWindowForDisplayId(display.id()); | 250 ->GetRootWindowForDisplayId(display.id()); |
252 gfx::Point origin = bounds.origin(); | 251 gfx::Point origin = bounds.origin(); |
253 ::wm::ConvertPointFromScreen(root, &origin); | 252 ::wm::ConvertPointFromScreen(root, &origin); |
254 window->SetBounds(gfx::Rect(origin, bounds.size())); | 253 window->SetBounds(gfx::Rect(origin, bounds.size())); |
255 aura::client::ParentWindowWithContext(window, root, bounds); | 254 aura::client::ParentWindowWithContext(window, root, bounds); |
256 } | 255 } |
257 window->SetProperty(aura::client::kCanMaximizeKey, true); | 256 window->SetProperty(aura::client::kCanMaximizeKey, true); |
258 window->SetProperty(aura::client::kCanMinimizeKey, true); | 257 window->SetProperty(aura::client::kCanMinimizeKey, true); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 336 |
338 void AshTestBase::DisableIME() { | 337 void AshTestBase::DisableIME() { |
339 Shell::GetInstance()->RemovePreTargetHandler( | 338 Shell::GetInstance()->RemovePreTargetHandler( |
340 Shell::GetInstance() | 339 Shell::GetInstance() |
341 ->window_tree_host_manager() | 340 ->window_tree_host_manager() |
342 ->input_method_event_handler()); | 341 ->input_method_event_handler()); |
343 } | 342 } |
344 | 343 |
345 } // namespace test | 344 } // namespace test |
346 } // namespace ash | 345 } // namespace ash |
OLD | NEW |