| 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 | 14 |
| 14 typedef unsigned int SkColor; | 15 typedef unsigned int SkColor; |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 class Layer; | 18 class Layer; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 class Compositor; | 22 class Compositor; |
| 22 class WebContents; | 23 class WebContents; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace ui { | 26 namespace ui { |
| 26 class WindowAndroid; | 27 class WindowAndroid; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace vr_shell { | 30 namespace vr_shell { |
| 30 | 31 |
| 31 class VrCompositor : public content::CompositorClient { | 32 class VrCompositor : public content::CompositorClient { |
| 32 public: | 33 public: |
| 33 VrCompositor(ui::WindowAndroid* window, bool is_transparent); | 34 VrCompositor(ui::WindowAndroid* window, bool is_transparent); |
| 34 ~VrCompositor() override; | 35 ~VrCompositor() override; |
| 35 | 36 |
| 36 void SurfaceDestroyed(); | 37 void SurfaceDestroyed(); |
| 37 void SetWindowBounds(int width, int height); | 38 void SetWindowBounds(gfx::Size size); |
| 39 gfx::Size GetWindowBounds() { return bounds_; } |
| 38 void SurfaceChanged(jobject surface); | 40 void SurfaceChanged(jobject surface); |
| 39 void SetLayer(content::WebContents* web_contents); | 41 void SetLayer(content::WebContents* web_contents); |
| 40 | 42 |
| 41 // CompositorClient implementation: | 43 // CompositorClient implementation: |
| 42 void UpdateLayerTreeHost() override; | 44 void UpdateLayerTreeHost() override; |
| 43 void OnSwapBuffersCompleted(int pending_swap_buffers) override; | 45 void OnSwapBuffersCompleted(int pending_swap_buffers) override; |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 std::unique_ptr<content::Compositor> compositor_; | 48 std::unique_ptr<content::Compositor> compositor_; |
| 49 gfx::Size bounds_; |
| 47 | 50 |
| 48 cc::Layer* layer_ = nullptr; | 51 cc::Layer* layer_ = nullptr; |
| 49 cc::Layer* layer_parent_ = nullptr; | 52 cc::Layer* layer_parent_ = nullptr; |
| 50 SkColor background_color_; | 53 SkColor background_color_; |
| 51 bool transparent_; | 54 bool transparent_; |
| 52 | 55 |
| 53 DISALLOW_COPY_AND_ASSIGN(VrCompositor); | 56 DISALLOW_COPY_AND_ASSIGN(VrCompositor); |
| 54 }; | 57 }; |
| 55 | 58 |
| 56 } // namespace vr_shell | 59 } // namespace vr_shell |
| 57 | 60 |
| 58 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_COMPOSITOR_H_ | 61 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_COMPOSITOR_H_ |
| OLD | NEW |