Chromium Code Reviews| 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/caca/ozone_platform_caca.h" | 5 #include "ui/ozone/platform/caca/ozone_platform_caca.h" |
| 6 | 6 |
| 7 #include "ui/ozone/common/platform_window_base.h" | 7 #include "ui/ozone/common/platform_window_base.h" |
| 8 #include "ui/ozone/platform/caca/caca_connection.h" | |
| 9 #include "ui/ozone/platform/caca/caca_event_factory.h" | 8 #include "ui/ozone/platform/caca/caca_event_factory.h" |
| 10 #include "ui/ozone/platform/caca/caca_surface_factory.h" | 9 #include "ui/ozone/platform/caca/caca_window.h" |
| 10 #include "ui/ozone/platform/caca/caca_window_manager.h" | |
| 11 #include "ui/ozone/public/cursor_factory_ozone.h" | 11 #include "ui/ozone/public/cursor_factory_ozone.h" |
| 12 #include "ui/ozone/public/ozone_platform.h" | 12 #include "ui/ozone/public/ozone_platform.h" |
| 13 | 13 |
| 14 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
| 15 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" | 15 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" |
| 16 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" | 16 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 namespace ui { | 19 namespace ui { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class OzonePlatformCaca : public OzonePlatform { | 23 class OzonePlatformCaca : public OzonePlatform { |
| 24 public: | 24 public: |
| 25 OzonePlatformCaca() {} | 25 OzonePlatformCaca() {} |
| 26 virtual ~OzonePlatformCaca() {} | 26 virtual ~OzonePlatformCaca() {} |
| 27 | 27 |
| 28 // OzonePlatform: | 28 // OzonePlatform: |
| 29 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { | 29 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { |
| 30 return surface_factory_ozone_.get(); | 30 return window_manager_.get(); |
| 31 } | 31 } |
| 32 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { | 32 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { |
| 33 return event_factory_ozone_.get(); | 33 return event_factory_ozone_.get(); |
| 34 } | 34 } |
| 35 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { | 35 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { |
| 36 return cursor_factory_ozone_.get(); | 36 return cursor_factory_ozone_.get(); |
| 37 } | 37 } |
| 38 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { | 38 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { |
| 39 return NULL; // no GPU support | 39 return NULL; // no GPU support |
| 40 } | 40 } |
| 41 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { | 41 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { |
| 42 return NULL; // no GPU support | 42 return NULL; // no GPU support |
| 43 } | 43 } |
| 44 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( | 44 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 45 PlatformWindowDelegate* delegate, | 45 PlatformWindowDelegate* delegate, |
| 46 const gfx::Rect& bounds) OVERRIDE { | 46 const gfx::Rect& bounds) { |
| 47 return make_scoped_ptr<PlatformWindow>( | 47 scoped_ptr<CacaWindow> caca_window(new CacaWindow( |
| 48 new PlatformWindowCompat(delegate, bounds)); | 48 delegate, window_manager_.get(), event_factory_ozone_.get(), bounds)); |
| 49 if (!caca_window->Initialize()) | |
| 50 return scoped_ptr<PlatformWindow>(); | |
| 51 return caca_window.PassAs<PlatformWindow>(); | |
| 49 } | 52 } |
| 50 | 53 |
| 51 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
| 52 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 55 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 53 OVERRIDE { | 56 OVERRIDE { |
| 54 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 57 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
| 55 } | 58 } |
| 56 virtual scoped_ptr<TouchscreenDeviceManager> | 59 virtual scoped_ptr<TouchscreenDeviceManager> |
| 57 CreateTouchscreenDeviceManager() OVERRIDE { | 60 CreateTouchscreenDeviceManager() OVERRIDE { |
| 58 return scoped_ptr<TouchscreenDeviceManager>( | 61 return scoped_ptr<TouchscreenDeviceManager>( |
| 59 new TouchscreenDeviceManagerOzone()); | 62 new TouchscreenDeviceManagerOzone()); |
| 60 } | 63 } |
| 61 #endif | 64 #endif |
| 62 | 65 |
| 63 virtual void InitializeUI() OVERRIDE { | 66 virtual void InitializeUI() OVERRIDE { |
| 64 surface_factory_ozone_.reset(new CacaSurfaceFactory(&connection_)); | 67 window_manager_.reset(new CacaWindowManager); |
| 65 event_factory_ozone_.reset(new CacaEventFactory(&connection_)); | 68 event_factory_ozone_.reset(new CacaEventFactory()); |
| 66 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 69 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
| 67 } | 70 } |
| 68 | 71 |
| 69 virtual void InitializeGPU() OVERRIDE {} | 72 virtual void InitializeGPU() OVERRIDE {} |
| 70 | 73 |
| 71 private: | 74 private: |
| 72 CacaConnection connection_; | 75 scoped_ptr<CacaWindowManager> window_manager_; |
| 73 scoped_ptr<CacaSurfaceFactory> surface_factory_ozone_; | |
| 74 scoped_ptr<CacaEventFactory> event_factory_ozone_; | 76 scoped_ptr<CacaEventFactory> event_factory_ozone_; |
| 75 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 77 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
| 76 | 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); | 79 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace | 82 } // namespace |
| 81 | 83 |
| 82 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } | 84 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } |
| 83 | 85 |
| 84 } // namespace ui | 86 } // namespace ui |
| 87 | |
|
dnicoara
2014/07/17 17:27:54
nit: Remove line.
spang
2014/07/17 19:50:41
Done.
| |
| OLD | NEW |