| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 5 #ifndef UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| 6 #define UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 6 #define UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/gfx/buffer_types.h" | 11 #include "ui/gfx/buffer_types.h" |
| 12 #include "ui/gfx/geometry/size.h" | |
| 13 #include "ui/ozone/ozone_export.h" | 12 #include "ui/ozone/ozone_export.h" |
| 14 #include "ui/ozone/public/client_native_pixmap.h" | 13 #include "ui/ozone/public/client_native_pixmap.h" |
| 15 | 14 |
| 15 namespace gfx { |
| 16 class NativePixmapHandle; |
| 17 class Size; |
| 18 } |
| 19 |
| 16 namespace base { | 20 namespace base { |
| 17 | 21 |
| 18 struct FileDescriptor; | 22 struct FileDescriptor; |
| 19 | 23 |
| 20 } // namespace base | 24 } // namespace base |
| 21 | 25 |
| 22 namespace ui { | 26 namespace ui { |
| 23 | 27 |
| 24 // The Ozone interface allows external implementations to hook into Chromium to | 28 // The Ozone interface allows external implementations to hook into Chromium to |
| 25 // provide a client pixmap for non-GPU processes. | 29 // provide a client pixmap for non-GPU processes. |
| 26 class OZONE_EXPORT ClientNativePixmapFactory { | 30 class OZONE_EXPORT ClientNativePixmapFactory { |
| 27 public: | 31 public: |
| 28 static ClientNativePixmapFactory* GetInstance(); | 32 static ClientNativePixmapFactory* GetInstance(); |
| 29 static void SetInstance(ClientNativePixmapFactory* instance); | 33 static void SetInstance(ClientNativePixmapFactory* instance); |
| 30 | 34 |
| 31 static scoped_ptr<ClientNativePixmapFactory> Create(); | 35 static scoped_ptr<ClientNativePixmapFactory> Create(); |
| 32 | 36 |
| 33 virtual ~ClientNativePixmapFactory(); | 37 virtual ~ClientNativePixmapFactory(); |
| 34 | 38 |
| 35 struct Configuration { | 39 struct Configuration { |
| 36 gfx::BufferFormat format; | 40 gfx::BufferFormat format; |
| 37 gfx::BufferUsage usage; | 41 gfx::BufferUsage usage; |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 // Gets supported format/usage configurations. | 44 // Gets supported format/usage configurations. |
| 41 virtual std::vector<Configuration> GetSupportedConfigurations() const = 0; | 45 virtual std::vector<Configuration> GetSupportedConfigurations() const = 0; |
| 42 | 46 |
| 43 // TODO(dshwang): implement it. crbug.com/475633 | 47 // TODO(dshwang): implement it. crbug.com/475633 |
| 44 // Import the native pixmap from |handle| to be used in non-GPU processes. | 48 // Import the native pixmap from |handle| to be used in non-GPU processes. |
| 45 virtual scoped_ptr<ClientNativePixmap> ImportNativePixmap( | 49 virtual scoped_ptr<ClientNativePixmap> ImportFromHandle( |
| 46 const base::FileDescriptor& handle, | 50 const gfx::NativePixmapHandle& handle, |
| 47 const gfx::Size& size, | 51 const gfx::Size& size, |
| 48 gfx::BufferFormat format, | 52 gfx::BufferFormat format, |
| 49 gfx::BufferUsage usage) = 0; | 53 gfx::BufferUsage usage) = 0; |
| 50 | 54 |
| 51 protected: | 55 protected: |
| 52 ClientNativePixmapFactory(); | 56 ClientNativePixmapFactory(); |
| 53 | 57 |
| 54 private: | 58 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactory); | 59 DISALLOW_COPY_AND_ASSIGN(ClientNativePixmapFactory); |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 } // namespace ui | 62 } // namespace ui |
| 59 | 63 |
| 60 #endif // UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ | 64 #endif // UI_OZONE_PUBLIC_CLIENT_NATIVE_PIXMAP_FACTORY_H_ |
| OLD | NEW |