Chromium Code Reviews| 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 "cc/output/filter_operations.h" | |
| 12 #include "chrome/browser/android/compositor/layer/layer.h" | 11 #include "chrome/browser/android/compositor/layer/layer.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 15 | 14 |
| 16 namespace cc { | 15 namespace cc { |
| 17 class Layer; | 16 class Layer; |
| 18 } | 17 } |
| 19 | 18 |
| 20 namespace android { | 19 namespace android { |
| 21 | 20 |
| 22 class TabContentManager; | 21 class TabContentManager; |
| 23 class ThumbnailLayer; | 22 class ThumbnailLayer; |
| 24 | 23 |
| 25 // Sub layer tree representation of the contents of a tab. | 24 // Sub layer tree representation of the contents of a tab. |
| 26 // Contains logic to temporarily display a static thumbnail | 25 // Contains logic to temporarily display a static thumbnail |
| 27 // when the content layer is not available. | 26 // when the content layer is not available. |
| 28 // To specialize call SetProperties. | 27 // To specialize call SetProperties. |
| 29 class ContentLayer : public Layer { | 28 class ContentLayer : public Layer { |
| 30 public: | 29 public: |
| 31 static scoped_refptr<ContentLayer> Create( | 30 static scoped_refptr<ContentLayer> Create( |
| 32 TabContentManager* tab_content_manager); | 31 TabContentManager* tab_content_manager); |
| 33 void SetProperties(int id, | 32 void SetProperties(int id, |
| 34 bool can_use_live_layer, | 33 bool can_use_live_layer, |
| 35 float static_to_view_blend, | 34 float static_to_view_blend, |
| 36 bool should_override_content_alpha, | 35 bool should_override_content_alpha, |
| 37 float content_alpha_override, | 36 float content_alpha_override, |
| 38 float saturation, | 37 float saturation, |
| 39 const gfx::Rect& desired_bounds, | 38 bool should_clip, |
|
Changwan Ryu
2016/12/12 07:38:04
optional: how about removing this parameter and ch
aelias_OOO_until_Jul13
2016/12/13 02:16:05
I considered that, but that would create a weird s
| |
| 40 const gfx::Size& content_size); | 39 const gfx::Rect& clip); |
| 41 bool ShowingLiveLayer() { return !static_attached_ && content_attached_; } | |
| 42 gfx::Size GetContentSize(); | |
| 43 | 40 |
| 44 scoped_refptr<cc::Layer> layer() override; | 41 scoped_refptr<cc::Layer> layer() override; |
| 45 | 42 |
| 46 protected: | 43 protected: |
| 47 explicit ContentLayer(TabContentManager* tab_content_manager); | 44 explicit ContentLayer(TabContentManager* tab_content_manager); |
| 48 ~ContentLayer() override; | 45 ~ContentLayer() override; |
| 49 | 46 |
| 50 private: | 47 private: |
| 51 void SetContentLayer(scoped_refptr<cc::Layer> layer); | 48 void SetContentLayer(scoped_refptr<cc::Layer> layer); |
| 52 void SetStaticLayer(scoped_refptr<ThumbnailLayer> layer); | 49 void SetStaticLayer(scoped_refptr<ThumbnailLayer> layer); |
| 53 void ClipContentLayer(scoped_refptr<cc::Layer> content_layer, | |
| 54 gfx::Rect clipping); | |
| 55 void ClipStaticLayer(scoped_refptr<ThumbnailLayer> static_layer, | |
| 56 gfx::Rect clipping); | |
| 57 | 50 |
| 51 // This is an intermediate shim layer whose children are | |
| 52 // both the static and content layers (or either, or none, depending on which | |
| 53 // is available). | |
| 58 scoped_refptr<cc::Layer> layer_; | 54 scoped_refptr<cc::Layer> layer_; |
| 59 scoped_refptr<ThumbnailLayer> static_layer_; | |
| 60 bool content_attached_; | |
| 61 bool static_attached_; | |
| 62 | |
| 63 cc::FilterOperations static_filter_operations_; | |
| 64 cc::FilterOperations content_filter_operations_; | |
| 65 | 55 |
| 66 TabContentManager* tab_content_manager_; | 56 TabContentManager* tab_content_manager_; |
| 67 | 57 |
| 68 DISALLOW_COPY_AND_ASSIGN(ContentLayer); | 58 DISALLOW_COPY_AND_ASSIGN(ContentLayer); |
| 69 }; | 59 }; |
| 70 | 60 |
| 71 } // namespace android | 61 } // namespace android |
| 72 | 62 |
| 73 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ | 63 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ |
| OLD | NEW |