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 #ifndef UI_OZONE_PLATFORM_CACA_CACA_SURFACE_FACTORY_H_ | 5 #ifndef UI_OZONE_PLATFORM_CACA_CACA_WINDOW_MANAGER_H_ |
6 #define UI_OZONE_PLATFORM_CACA_CACA_SURFACE_FACTORY_H_ | 6 #define UI_OZONE_PLATFORM_CACA_CACA_WINDOW_MANAGER_H_ |
7 | 7 |
8 #include <caca.h> | 8 #include "base/id_map.h" |
9 | |
10 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
11 #include "ui/ozone/public/surface_factory_ozone.h" | 10 #include "ui/ozone/public/surface_factory_ozone.h" |
12 | 11 |
13 namespace gfx { | 12 namespace gfx { |
14 class SurfaceOzone; | 13 class Rect; |
15 } | 14 } |
16 | 15 |
17 namespace ui { | 16 namespace ui { |
18 | 17 |
19 class CacaConnection; | 18 class CacaWindow; |
20 | 19 |
21 class CacaSurfaceFactory : public ui::SurfaceFactoryOzone { | 20 class CacaWindowManager : public SurfaceFactoryOzone { |
22 public: | 21 public: |
23 CacaSurfaceFactory(CacaConnection* connection); | 22 CacaWindowManager(); |
24 virtual ~CacaSurfaceFactory(); | 23 virtual ~CacaWindowManager(); |
| 24 |
| 25 // Register a new libcaca window/instance. Returns the window id. |
| 26 int32_t AddWindow(CacaWindow* window); |
| 27 |
| 28 // Remove a libcaca window/instance. |
| 29 void RemoveWindow(int32_t window_id, CacaWindow* window); |
25 | 30 |
26 // ui::SurfaceFactoryOzone overrides: | 31 // ui::SurfaceFactoryOzone overrides: |
27 virtual HardwareState InitializeHardware() OVERRIDE; | 32 virtual HardwareState InitializeHardware() OVERRIDE; |
28 virtual void ShutdownHardware() OVERRIDE; | 33 virtual void ShutdownHardware() OVERRIDE; |
29 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; | 34 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; |
30 virtual bool LoadEGLGLES2Bindings( | 35 virtual bool LoadEGLGLES2Bindings( |
31 AddGLLibraryCallback add_gl_library, | 36 AddGLLibraryCallback add_gl_library, |
32 SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; | 37 SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE; |
33 virtual scoped_ptr<ui::SurfaceOzoneCanvas> CreateCanvasForWidget( | 38 virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( |
34 gfx::AcceleratedWidget widget) OVERRIDE; | 39 gfx::AcceleratedWidget widget) OVERRIDE; |
35 | 40 |
36 private: | 41 private: |
37 HardwareState state_; | 42 IDMap<CacaWindow> windows_; |
38 | 43 |
39 CacaConnection* connection_; // Not owned. | 44 DISALLOW_COPY_AND_ASSIGN(CacaWindowManager); |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(CacaSurfaceFactory); | |
42 }; | 45 }; |
43 | 46 |
44 } // namespace ui | 47 } // namespace ui |
45 | 48 |
46 #endif // UI_OZONE_PLATFORM_CACA_CACA_SURFACE_FACTORY_H_ | 49 #endif // UI_OZONE_PLATFORM_CACA_CACA_WINDOW_MANAGER_H_ |
OLD | NEW |