| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_COMPOSITOR_LAYER_CONTENT_LAYER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ | 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/android/compositor/layer/layer.h" | 11 #include "chrome/browser/android/compositor/layer/layer.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 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 class Layer; | 16 class Layer; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace android { | 19 namespace android { |
| 20 | 20 |
| 21 class TabContentManager; | 21 class TabContentManager; |
| 22 class ThumbnailLayer; | |
| 23 | 22 |
| 24 // Sub layer tree representation of the contents of a tab. | 23 // Sub layer tree representation of the contents of a tab. |
| 25 // Contains logic to temporarily display a static thumbnail | 24 // Contains logic to temporarily display a static thumbnail |
| 26 // when the content layer is not available. | 25 // when the content layer is not available. |
| 27 // To specialize call SetProperties. | 26 // To specialize call SetProperties. |
| 28 class ContentLayer : public Layer { | 27 class ContentLayer : public Layer { |
| 29 public: | 28 public: |
| 30 static scoped_refptr<ContentLayer> Create( | 29 static scoped_refptr<ContentLayer> Create( |
| 31 TabContentManager* tab_content_manager); | 30 TabContentManager* tab_content_manager); |
| 32 void SetProperties(int id, | 31 void SetProperties(int id, |
| 33 bool can_use_live_layer, | 32 bool can_use_live_layer, |
| 34 float static_to_view_blend, | 33 float static_to_view_blend, |
| 35 bool should_override_content_alpha, | 34 bool should_override_content_alpha, |
| 36 float content_alpha_override, | 35 float content_alpha_override, |
| 37 float saturation, | 36 float saturation, |
| 38 bool should_clip, | 37 bool should_clip, |
| 39 const gfx::Rect& clip); | 38 const gfx::Rect& clip); |
| 40 | 39 |
| 41 scoped_refptr<cc::Layer> layer() override; | 40 scoped_refptr<cc::Layer> layer() override; |
| 42 | 41 |
| 42 gfx::Size ComputeSize(int id) const; |
| 43 |
| 43 protected: | 44 protected: |
| 44 explicit ContentLayer(TabContentManager* tab_content_manager); | 45 explicit ContentLayer(TabContentManager* tab_content_manager); |
| 45 ~ContentLayer() override; | 46 ~ContentLayer() override; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 void SetContentLayer(scoped_refptr<cc::Layer> layer); | |
| 49 void SetStaticLayer(scoped_refptr<ThumbnailLayer> layer); | |
| 50 | |
| 51 // This is an intermediate shim layer whose children are | 49 // This is an intermediate shim layer whose children are |
| 52 // both the static and content layers (or either, or none, depending on which | 50 // both the static and content layers (or either, or none, depending on which |
| 53 // is available). | 51 // is available). |
| 54 scoped_refptr<cc::Layer> layer_; | 52 scoped_refptr<cc::Layer> layer_; |
| 55 | 53 |
| 56 TabContentManager* tab_content_manager_; | 54 TabContentManager* tab_content_manager_; |
| 57 | 55 |
| 58 DISALLOW_COPY_AND_ASSIGN(ContentLayer); | 56 DISALLOW_COPY_AND_ASSIGN(ContentLayer); |
| 59 }; | 57 }; |
| 60 | 58 |
| 61 } // namespace android | 59 } // namespace android |
| 62 | 60 |
| 63 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ | 61 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ |
| OLD | NEW |