| 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/display/extended_mouse_warp_controller.h" | 10 #include "ash/display/extended_mouse_warp_controller.h" |
| 11 #include "ash/display/mouse_cursor_event_filter.h" | 11 #include "ash/display/mouse_cursor_event_filter.h" |
| 12 #include "ash/display/unified_mouse_warp_controller.h" | 12 #include "ash/display/unified_mouse_warp_controller.h" |
| 13 #include "ash/display/window_tree_host_manager.h" | 13 #include "ash/display/window_tree_host_manager.h" |
| 14 #include "ash/mus/top_level_window_factory.h" | 14 #include "ash/mus/top_level_window_factory.h" |
| 15 #include "ash/mus/window_manager.h" | 15 #include "ash/mus/window_manager.h" |
| 16 #include "ash/mus/window_manager_application.h" | 16 #include "ash/mus/window_manager_application.h" |
| 17 #include "ash/public/cpp/config.h" | 17 #include "ash/public/cpp/config.h" |
| 18 #include "ash/public/cpp/window_properties.h" | 18 #include "ash/public/cpp/window_properties.h" |
| 19 #include "ash/root_window_controller.h" | 19 #include "ash/root_window_controller.h" |
| 20 #include "ash/session/session_controller.h" | 20 #include "ash/session/session_controller.h" |
| 21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 22 #include "ash/shell/toplevel_window.h" | 22 #include "ash/shell/toplevel_window.h" |
| 23 #include "ash/shell_port.h" | 23 #include "ash/shell_port.h" |
| 24 #include "ash/test/ash_test_environment.h" | 24 #include "ash/test/ash_test_environment.h" |
| 25 #include "ash/test/ash_test_helper.h" | 25 #include "ash/test/ash_test_helper.h" |
| 26 #include "ash/test/test_session_controller_client.h" | 26 #include "ash/test/test_session_controller_client.h" |
| 27 #include "ash/test/test_shell_delegate.h" | 27 #include "ash/test/test_shell_delegate.h" |
| 28 #include "ash/test/test_system_tray_delegate.h" | 28 #include "ash/test/test_system_tray_delegate.h" |
| 29 #include "ash/wm/window_positioner.h" | 29 #include "ash/wm/window_positioner.h" |
| 30 #include "ash/wm_window.h" | |
| 31 #include "services/ui/public/cpp/property_type_converters.h" | 30 #include "services/ui/public/cpp/property_type_converters.h" |
| 32 #include "services/ui/public/interfaces/window_manager.mojom.h" | 31 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 33 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 32 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 34 #include "ui/aura/client/aura_constants.h" | 33 #include "ui/aura/client/aura_constants.h" |
| 35 #include "ui/aura/client/screen_position_client.h" | 34 #include "ui/aura/client/screen_position_client.h" |
| 36 #include "ui/aura/client/window_parenting_client.h" | 35 #include "ui/aura/client/window_parenting_client.h" |
| 37 #include "ui/aura/env.h" | 36 #include "ui/aura/env.h" |
| 38 #include "ui/aura/mus/property_converter.h" | 37 #include "ui/aura/mus/property_converter.h" |
| 39 #include "ui/aura/test/aura_test_utils.h" | 38 #include "ui/aura/test/aura_test_utils.h" |
| 40 #include "ui/aura/test/event_generator_delegate_aura.h" | 39 #include "ui/aura/test/event_generator_delegate_aura.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void DispatchKeyEventToIME(ui::EventTarget* target, | 82 void DispatchKeyEventToIME(ui::EventTarget* target, |
| 84 ui::KeyEvent* event) override { | 83 ui::KeyEvent* event) override { |
| 85 // In Ash environment, the key event will be processed by event rewriters | 84 // In Ash environment, the key event will be processed by event rewriters |
| 86 // first. | 85 // first. |
| 87 } | 86 } |
| 88 | 87 |
| 89 private: | 88 private: |
| 90 DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate); | 89 DISALLOW_COPY_AND_ASSIGN(AshEventGeneratorDelegate); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 ui::mojom::WindowType MusWindowTypeFromWmWindowType( | 92 ui::mojom::WindowType MusWindowTypeFromWindowType( |
| 94 aura::client::WindowType window_type) { | 93 aura::client::WindowType window_type) { |
| 95 switch (window_type) { | 94 switch (window_type) { |
| 96 case aura::client::WINDOW_TYPE_UNKNOWN: | 95 case aura::client::WINDOW_TYPE_UNKNOWN: |
| 97 break; | 96 break; |
| 98 | 97 |
| 99 case aura::client::WINDOW_TYPE_NORMAL: | 98 case aura::client::WINDOW_TYPE_NORMAL: |
| 100 return ui::mojom::WindowType::WINDOW; | 99 return ui::mojom::WindowType::WINDOW; |
| 101 | 100 |
| 102 case aura::client::WINDOW_TYPE_POPUP: | 101 case aura::client::WINDOW_TYPE_POPUP: |
| 103 return ui::mojom::WindowType::POPUP; | 102 return ui::mojom::WindowType::POPUP; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 291 } |
| 293 | 292 |
| 294 properties[ui::mojom::WindowManager::kResizeBehavior_Property] = | 293 properties[ui::mojom::WindowManager::kResizeBehavior_Property] = |
| 295 mojo::ConvertTo<std::vector<uint8_t>>( | 294 mojo::ConvertTo<std::vector<uint8_t>>( |
| 296 static_cast<aura::PropertyConverter::PrimitiveType>( | 295 static_cast<aura::PropertyConverter::PrimitiveType>( |
| 297 ui::mojom::kResizeBehaviorCanResize | | 296 ui::mojom::kResizeBehaviorCanResize | |
| 298 ui::mojom::kResizeBehaviorCanMaximize | | 297 ui::mojom::kResizeBehaviorCanMaximize | |
| 299 ui::mojom::kResizeBehaviorCanMinimize)); | 298 ui::mojom::kResizeBehaviorCanMinimize)); |
| 300 | 299 |
| 301 const ui::mojom::WindowType mus_window_type = | 300 const ui::mojom::WindowType mus_window_type = |
| 302 MusWindowTypeFromWmWindowType(type); | 301 MusWindowTypeFromWindowType(type); |
| 303 mus::WindowManager* window_manager = | 302 mus::WindowManager* window_manager = |
| 304 ash_test_helper_->window_manager_app()->window_manager(); | 303 ash_test_helper_->window_manager_app()->window_manager(); |
| 305 aura::Window* window = mus::CreateAndParentTopLevelWindow( | 304 aura::Window* window = mus::CreateAndParentTopLevelWindow( |
| 306 window_manager, mus_window_type, &properties); | 305 window_manager, mus_window_type, &properties); |
| 307 window->set_id(shell_window_id); | 306 window->set_id(shell_window_id); |
| 308 window->Show(); | 307 window->Show(); |
| 309 return base::WrapUnique<aura::Window>(window); | 308 return base::WrapUnique<aura::Window>(window); |
| 310 } | 309 } |
| 311 | 310 |
| 312 std::unique_ptr<aura::Window> AshTestBase::CreateToplevelTestWindow( | 311 std::unique_ptr<aura::Window> AshTestBase::CreateToplevelTestWindow( |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 return display::Screen::GetScreen()->GetDisplayNearestWindow( | 503 return display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 505 Shell::GetPrimaryRootWindow()); | 504 Shell::GetPrimaryRootWindow()); |
| 506 } | 505 } |
| 507 | 506 |
| 508 display::Display AshTestBase::GetSecondaryDisplay() { | 507 display::Display AshTestBase::GetSecondaryDisplay() { |
| 509 return ash_test_helper_->GetSecondaryDisplay(); | 508 return ash_test_helper_->GetSecondaryDisplay(); |
| 510 } | 509 } |
| 511 | 510 |
| 512 } // namespace test | 511 } // namespace test |
| 513 } // namespace ash | 512 } // namespace ash |
| OLD | NEW |