| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 6 #define CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "cc/resources/ui_resource_bitmap.h" | 9 #include "cc/resources/ui_resource_bitmap.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "ui/android/resources/ui_resource_provider.h" | 11 #include "ui/android/resources/ui_resource_provider.h" |
| 12 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 class Layer; | 17 class Layer; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 class ResourceManager; | 21 class ResourceManager; |
| 22 class UIResourceProvider; | 22 class UIResourceProvider; |
| 23 class ViewRoot; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace content { | 26 namespace content { |
| 26 class CompositorClient; | 27 class CompositorClient; |
| 27 | 28 |
| 28 // An interface to the browser-side compositor. | 29 // An interface to the browser-side compositor. |
| 29 class CONTENT_EXPORT Compositor { | 30 class CONTENT_EXPORT Compositor { |
| 30 public: | 31 public: |
| 31 virtual ~Compositor() {} | 32 virtual ~Compositor() {} |
| 32 | 33 |
| 33 // Performs the global initialization needed before any compositor | 34 // Performs the global initialization needed before any compositor |
| 34 // instance can be used. This should be called only once. | 35 // instance can be used. This should be called only once. |
| 35 static void Initialize(); | 36 static void Initialize(); |
| 36 | 37 |
| 37 // Creates and returns a compositor instance. |root_window| needs to outlive | 38 // Creates and returns a compositor instance. |view_root| needs to outlive |
| 38 // the compositor as it manages callbacks on the compositor. | 39 // the compositor as it manages callbacks on the compositor. |
| 39 static Compositor* Create(CompositorClient* client, | 40 static Compositor* Create(CompositorClient* client, |
| 40 gfx::NativeWindow root_window); | 41 ui::ViewRoot* view_root); |
| 41 | 42 |
| 42 // Attaches the layer tree. | 43 // Attaches the layer tree. |
| 43 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) = 0; | 44 virtual void SetRootLayer(scoped_refptr<cc::Layer> root) = 0; |
| 44 | 45 |
| 45 // Set the output surface bounds. | 46 // Set the output surface bounds. |
| 46 virtual void SetWindowBounds(const gfx::Size& size) = 0; | 47 virtual void SetWindowBounds(const gfx::Size& size) = 0; |
| 47 | 48 |
| 48 // Set the output surface which the compositor renders into. | 49 // Set the output surface which the compositor renders into. |
| 49 virtual void SetSurface(jobject surface) = 0; | 50 virtual void SetSurface(jobject surface) = 0; |
| 50 | 51 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 // Returns the resource manager associated with the compositor. | 62 // Returns the resource manager associated with the compositor. |
| 62 virtual ui::ResourceManager& GetResourceManager() = 0; | 63 virtual ui::ResourceManager& GetResourceManager() = 0; |
| 63 | 64 |
| 64 protected: | 65 protected: |
| 65 Compositor() {} | 66 Compositor() {} |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 } // namespace content | 69 } // namespace content |
| 69 | 70 |
| 70 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ | 71 #endif // CONTENT_PUBLIC_BROWSER_ANDROID_COMPOSITOR_H_ |
| OLD | NEW |