Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/ozone/platform/x11/ozone_platform_x11.h" | |
| 6 | |
| 7 #include "base/at_exit.h" | |
| 8 #include "base/bind.h" | |
| 9 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | |
| 10 #include "ui/ozone/common/native_display_delegate_ozone.h" | |
| 11 #include "ui/ozone/platform/x11/x11_input_controller.h" | |
| 12 #include "ui/ozone/platform/x11/x11_surface_factory.h" | |
| 13 #include "ui/ozone/public/gpu_platform_support.h" | |
| 14 #include "ui/ozone/public/gpu_platform_support_host.h" | |
| 15 #include "ui/ozone/public/ozone_platform.h" | |
| 16 #include "ui/ozone/public/system_input_injector.h" | |
| 17 #include "ui/ozone/public/ui_thread_gpu.h" | |
| 18 #include "ui/platform_window/x11/x11_window.h" | |
| 19 | |
| 20 namespace ui { | |
| 21 namespace { | |
| 22 | |
| 23 // OzonePlatform for Linux X11 | |
| 24 class OzonePlatformX11 : public OzonePlatform { | |
| 25 public: | |
| 26 OzonePlatformX11() { | |
| 27 base::AtExitManager::RegisterTask( | |
| 28 base::Bind(&base::DeletePointer<OzonePlatformX11>, this)); | |
| 29 } | |
| 30 virtual ~OzonePlatformX11() {} | |
| 31 | |
| 32 // OzonePlatform: | |
| 33 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { | |
| 34 return surface_factory_ozone_.get(); | |
| 35 } | |
| 36 CursorFactoryOzone* GetCursorFactoryOzone() override { | |
| 37 return cursor_factory_ozone_.get(); | |
| 38 } | |
| 39 GpuPlatformSupport* GetGpuPlatformSupport() override { | |
| 40 return gpu_platform_support_.get(); | |
| 41 } | |
| 42 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | |
| 43 return gpu_platform_support_host_.get(); | |
| 44 } | |
| 45 scoped_ptr<PlatformWindow> CreatePlatformWindow( | |
| 46 PlatformWindowDelegate* delegate, | |
| 47 const gfx::Rect& bounds) override { | |
| 48 scoped_ptr<X11Window> window = | |
| 49 window_manager_->CreatePlatformWindow(delegate).Pass(); | |
|
spang
2014/12/06 00:31:23
I don't think you need the .Pass() here.
| |
| 50 window->SetBounds(bounds); | |
| 51 window->Create(); | |
| 52 return window.Pass(); | |
| 53 } | |
| 54 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | |
| 55 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | |
| 56 } | |
| 57 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { | |
| 58 NOTREACHED(); | |
| 59 return scoped_ptr<SystemInputInjector>(); | |
| 60 } | |
| 61 InputController* GetInputController() override { return &input_controller_; } | |
| 62 void InitializeUI() override { | |
| 63 if (!window_manager_) | |
| 64 window_manager_ = new X11WindowManager(); | |
| 65 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | |
| 66 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | |
| 67 surface_factory_ozone_.reset(new X11SurfaceFactory(window_manager_)); | |
| 68 } | |
| 69 | |
| 70 void InitializeGPU() override { | |
| 71 if (!window_manager_) | |
| 72 window_manager_ = new X11WindowManager(); | |
| 73 if (!surface_factory_ozone_) | |
| 74 surface_factory_ozone_.reset(new X11SurfaceFactory(window_manager_)); | |
| 75 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | |
| 76 } | |
| 77 | |
| 78 private: | |
| 79 X11InputController input_controller_; | |
|
spang
2014/12/06 00:31:23
I don't think it makes sense to have an input cont
achaulk
2014/12/08 16:44:41
It's just a stub for now. If it really is as simpl
spang
2014/12/09 19:47:33
Would still prefer you put it in the scoped_ptr<>
| |
| 80 scoped_ptr<X11SurfaceFactory> surface_factory_ozone_; | |
| 81 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | |
| 82 | |
| 83 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; | |
| 84 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | |
| 85 | |
| 86 scoped_refptr<X11WindowManager> window_manager_; | |
| 87 | |
| 88 DISALLOW_COPY_AND_ASSIGN(OzonePlatformX11); | |
| 89 }; | |
| 90 | |
| 91 } // namespace | |
| 92 | |
| 93 OzonePlatform* CreateOzonePlatformX11() { | |
| 94 return new OzonePlatformX11; | |
| 95 } | |
| 96 | |
| 97 } // namespace ui | |
| OLD | NEW |