| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/ozone/platform/egltest/ozone_platform_egltest.h" | 5 #include "ui/ozone/platform/egltest/ozone_platform_egltest.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "library_loaders/libeglplatform_shim.h" | 12 #include "library_loaders/libeglplatform_shim.h" |
| 13 #include "third_party/khronos/EGL/egl.h" | 13 #include "third_party/khronos/EGL/egl.h" |
| 14 #include "ui/events/ozone/device/device_manager.h" | 14 #include "ui/events/ozone/device/device_manager.h" |
| 15 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 15 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 16 #include "ui/events/ozone/events_ozone.h" | 16 #include "ui/events/ozone/events_ozone.h" |
| 17 #include "ui/events/ozone/layout/stub/stub_keyboard_layouts.h" |
| 17 #include "ui/events/platform/platform_event_dispatcher.h" | 18 #include "ui/events/platform/platform_event_dispatcher.h" |
| 18 #include "ui/gfx/vsync_provider.h" | 19 #include "ui/gfx/vsync_provider.h" |
| 19 #include "ui/ozone/common/native_display_delegate_ozone.h" | 20 #include "ui/ozone/common/native_display_delegate_ozone.h" |
| 20 #include "ui/ozone/public/cursor_factory_ozone.h" | 21 #include "ui/ozone/public/cursor_factory_ozone.h" |
| 21 #include "ui/ozone/public/gpu_platform_support.h" | 22 #include "ui/ozone/public/gpu_platform_support.h" |
| 22 #include "ui/ozone/public/gpu_platform_support_host.h" | 23 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 23 #include "ui/ozone/public/ozone_platform.h" | 24 #include "ui/ozone/public/ozone_platform.h" |
| 24 #include "ui/ozone/public/ozone_switches.h" | 25 #include "ui/ozone/public/ozone_switches.h" |
| 25 #include "ui/ozone/public/surface_factory_ozone.h" | 26 #include "ui/ozone/public/surface_factory_ozone.h" |
| 26 #include "ui/ozone/public/surface_ozone_egl.h" | 27 #include "ui/ozone/public/surface_ozone_egl.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 } | 321 } |
| 321 CursorFactoryOzone* GetCursorFactoryOzone() override { | 322 CursorFactoryOzone* GetCursorFactoryOzone() override { |
| 322 return cursor_factory_ozone_.get(); | 323 return cursor_factory_ozone_.get(); |
| 323 } | 324 } |
| 324 GpuPlatformSupport* GetGpuPlatformSupport() override { | 325 GpuPlatformSupport* GetGpuPlatformSupport() override { |
| 325 return gpu_platform_support_.get(); | 326 return gpu_platform_support_.get(); |
| 326 } | 327 } |
| 327 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 328 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
| 328 return gpu_platform_support_host_.get(); | 329 return gpu_platform_support_host_.get(); |
| 329 } | 330 } |
| 331 KeyboardLayoutsOzone* GetKeyboardLayouts() override { |
| 332 return keyboard_layouts_ozone_.get(); |
| 333 } |
| 330 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 334 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 331 PlatformWindowDelegate* delegate, | 335 PlatformWindowDelegate* delegate, |
| 332 const gfx::Rect& bounds) override { | 336 const gfx::Rect& bounds) override { |
| 333 return make_scoped_ptr<PlatformWindow>( | 337 return make_scoped_ptr<PlatformWindow>( |
| 334 new EgltestWindow(delegate, | 338 new EgltestWindow(delegate, |
| 335 &eglplatform_shim_, | 339 &eglplatform_shim_, |
| 336 event_factory_ozone_.get(), | 340 event_factory_ozone_.get(), |
| 337 bounds)); | 341 bounds)); |
| 338 } | 342 } |
| 339 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 343 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
| 340 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 344 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
| 341 } | 345 } |
| 342 | 346 |
| 343 void InitializeUI() override { | 347 void InitializeUI() override { |
| 344 device_manager_ = CreateDeviceManager(); | 348 device_manager_ = CreateDeviceManager(); |
| 345 if (!surface_factory_ozone_) | 349 if (!surface_factory_ozone_) |
| 346 surface_factory_ozone_.reset( | 350 surface_factory_ozone_.reset( |
| 347 new SurfaceFactoryEgltest(&eglplatform_shim_)); | 351 new SurfaceFactoryEgltest(&eglplatform_shim_)); |
| 348 event_factory_ozone_.reset( | 352 event_factory_ozone_.reset( |
| 349 new EventFactoryEvdev(NULL, device_manager_.get())); | 353 new EventFactoryEvdev(NULL, device_manager_.get())); |
| 350 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 354 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
| 351 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 355 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 356 keyboard_layouts_ozone_.reset(new StubKeyboardLayouts()); |
| 352 } | 357 } |
| 353 | 358 |
| 354 void InitializeGPU() override { | 359 void InitializeGPU() override { |
| 355 if (!surface_factory_ozone_) | 360 if (!surface_factory_ozone_) |
| 356 surface_factory_ozone_.reset( | 361 surface_factory_ozone_.reset( |
| 357 new SurfaceFactoryEgltest(&eglplatform_shim_)); | 362 new SurfaceFactoryEgltest(&eglplatform_shim_)); |
| 358 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 363 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
| 359 } | 364 } |
| 360 | 365 |
| 361 private: | 366 private: |
| 362 LibeglplatformShimLoader eglplatform_shim_; | 367 LibeglplatformShimLoader eglplatform_shim_; |
| 363 scoped_ptr<DeviceManager> device_manager_; | 368 scoped_ptr<DeviceManager> device_manager_; |
| 364 scoped_ptr<SurfaceFactoryEgltest> surface_factory_ozone_; | 369 scoped_ptr<SurfaceFactoryEgltest> surface_factory_ozone_; |
| 365 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 370 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 366 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 371 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
| 367 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; | 372 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
| 368 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 373 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 374 scoped_ptr<KeyboardLayoutsOzone> keyboard_layouts_ozone_; |
| 369 | 375 |
| 370 bool shim_initialized_; | 376 bool shim_initialized_; |
| 371 | 377 |
| 372 DISALLOW_COPY_AND_ASSIGN(OzonePlatformEgltest); | 378 DISALLOW_COPY_AND_ASSIGN(OzonePlatformEgltest); |
| 373 }; | 379 }; |
| 374 | 380 |
| 375 } // namespace | 381 } // namespace |
| 376 | 382 |
| 377 OzonePlatform* CreateOzonePlatformEgltest() { | 383 OzonePlatform* CreateOzonePlatformEgltest() { |
| 378 OzonePlatformEgltest* platform = new OzonePlatformEgltest; | 384 OzonePlatformEgltest* platform = new OzonePlatformEgltest; |
| 379 platform->Initialize(); | 385 platform->Initialize(); |
| 380 return platform; | 386 return platform; |
| 381 } | 387 } |
| 382 | 388 |
| 383 } // namespace ui | 389 } // namespace ui |
| OLD | NEW |