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 <jni.h> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "cc/resources/ui_resource_bitmap.h" | 11 #include "cc/resources/ui_resource_bitmap.h" |
10 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
11 #include "ui/android/resources/ui_resource_provider.h" | 13 #include "ui/android/resources/ui_resource_provider.h" |
12 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
14 #include "ui/gfx/native_widget_types.h" | |
15 | 16 |
16 namespace cc { | 17 namespace cc { |
17 class Layer; | 18 class Layer; |
18 } | 19 } |
19 | 20 |
20 namespace ui { | 21 namespace ui { |
21 class ResourceManager; | 22 class ResourceManager; |
22 class UIResourceProvider; | 23 class UIResourceProvider; |
| 24 class ViewRoot; |
23 } | 25 } |
24 | 26 |
25 namespace content { | 27 namespace content { |
26 class CompositorClient; | 28 class CompositorClient; |
27 | 29 |
28 // An interface to the browser-side compositor. | 30 // An interface to the browser-side compositor. |
29 class CONTENT_EXPORT Compositor { | 31 class CONTENT_EXPORT Compositor { |
30 public: | 32 public: |
31 virtual ~Compositor() {} | 33 virtual ~Compositor() {} |
32 | 34 |
33 // Performs the global initialization needed before any compositor | 35 // Performs the global initialization needed before any compositor |
34 // instance can be used. This should be called only once. | 36 // instance can be used. This should be called only once. |
35 static void Initialize(); | 37 static void Initialize(); |
36 | 38 |
37 // Creates and returns a compositor instance. |root_window| needs to outlive | 39 // Creates and returns a compositor instance. |view_root| needs to outlive |
38 // the compositor as it manages callbacks on the compositor. | 40 // the compositor as it manages callbacks on the compositor. |
39 static Compositor* Create(CompositorClient* client, | 41 static Compositor* Create(CompositorClient* client, ui::ViewRoot* view_root); |
40 gfx::NativeWindow root_window); | |
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 |