| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_VR_SHELL_VR_COMPOSITOR_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_COMPOSITOR_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_COMPOSITOR_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_COMPOSITOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "content/public/browser/android/compositor_client.h" | 12 #include "content/public/browser/android/compositor_client.h" |
| 13 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 14 | 14 |
| 15 typedef unsigned int SkColor; | 15 typedef unsigned int SkColor; |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 class Layer; | 18 class Layer; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class Compositor; | 22 class Compositor; |
| 23 class WebContents; | 23 class WebContents; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace ui { | 26 namespace ui { |
| 27 class WindowAndroid; | 27 class ViewRoot; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace vr_shell { | 30 namespace vr_shell { |
| 31 | 31 |
| 32 class VrCompositor : public content::CompositorClient { | 32 class VrCompositor : public content::CompositorClient { |
| 33 public: | 33 public: |
| 34 VrCompositor(ui::WindowAndroid* window, bool is_transparent); | 34 VrCompositor(ui::ViewRoot* window, bool is_transparent); |
| 35 ~VrCompositor() override; | 35 ~VrCompositor() override; |
| 36 | 36 |
| 37 void SurfaceDestroyed(); | 37 void SurfaceDestroyed(); |
| 38 void SetWindowBounds(gfx::Size size); | 38 void SetWindowBounds(gfx::Size size); |
| 39 gfx::Size GetWindowBounds() { return bounds_; } | 39 gfx::Size GetWindowBounds() { return bounds_; } |
| 40 void SurfaceChanged(jobject surface); | 40 void SurfaceChanged(jobject surface); |
| 41 void SetLayer(content::WebContents* web_contents); | 41 void SetLayer(content::WebContents* web_contents); |
| 42 | 42 |
| 43 // CompositorClient implementation: | 43 // CompositorClient implementation: |
| 44 void UpdateLayerTreeHost() override; | 44 void UpdateLayerTreeHost() override; |
| 45 void OnSwapBuffersCompleted(int pending_swap_buffers) override; | 45 void OnSwapBuffersCompleted(int pending_swap_buffers) override; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 std::unique_ptr<content::Compositor> compositor_; | 48 std::unique_ptr<content::Compositor> compositor_; |
| 49 gfx::Size bounds_; | 49 gfx::Size bounds_; |
| 50 | 50 |
| 51 cc::Layer* layer_ = nullptr; | 51 cc::Layer* layer_ = nullptr; |
| 52 cc::Layer* layer_parent_ = nullptr; | 52 cc::Layer* layer_parent_ = nullptr; |
| 53 SkColor background_color_; | 53 SkColor background_color_; |
| 54 bool transparent_; | 54 bool transparent_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(VrCompositor); | 56 DISALLOW_COPY_AND_ASSIGN(VrCompositor); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace vr_shell | 59 } // namespace vr_shell |
| 60 | 60 |
| 61 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_COMPOSITOR_H_ | 61 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_COMPOSITOR_H_ |
| OLD | NEW |