OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/android/compositor/layer/layer.h" |
| 11 #include "ui/gfx/rect.h" |
| 12 #include "ui/gfx/size.h" |
| 13 |
| 14 namespace cc { |
| 15 class Layer; |
| 16 } |
| 17 |
| 18 namespace chrome { |
| 19 namespace android { |
| 20 |
| 21 class TabContentManager; |
| 22 class ThumbnailLayer; |
| 23 |
| 24 // Sub layer tree representation of the contents of a tab. |
| 25 // Contains logic to temporarily display a static thumbnail |
| 26 // when the content layer is not available. |
| 27 // To specialize call SetProperties. |
| 28 class ContentLayer : public Layer { |
| 29 public: |
| 30 static scoped_refptr<ContentLayer> Create( |
| 31 TabContentManager* tab_content_manager); |
| 32 void SetProperties(int id, |
| 33 bool can_use_live_layer, |
| 34 bool can_use_ntp_fallback, |
| 35 float static_to_view_blend, |
| 36 bool should_override_content_alpha, |
| 37 float content_alpha_override, |
| 38 float saturation, |
| 39 const gfx::Rect& desired_bounds, |
| 40 const gfx::Size& content_size); |
| 41 bool ShowingLiveLayer() { return !static_attached_ && content_attached_; } |
| 42 gfx::Size GetContentSize(); |
| 43 |
| 44 scoped_refptr<cc::Layer> layer() override; |
| 45 |
| 46 protected: |
| 47 explicit ContentLayer(TabContentManager* tab_content_manager); |
| 48 ~ContentLayer() override; |
| 49 |
| 50 private: |
| 51 void SetContentLayer(scoped_refptr<cc::Layer> layer); |
| 52 void SetStaticLayer(scoped_refptr<ThumbnailLayer> layer); |
| 53 void ClipContentLayer(scoped_refptr<cc::Layer> content_layer, |
| 54 gfx::Rect clipping, |
| 55 gfx::Size content_size); |
| 56 void ClipStaticLayer(scoped_refptr<ThumbnailLayer> static_layer, |
| 57 gfx::Rect clipping); |
| 58 |
| 59 scoped_refptr<cc::Layer> layer_; |
| 60 scoped_refptr<ThumbnailLayer> static_layer_; |
| 61 bool content_attached_; |
| 62 bool static_attached_; |
| 63 float saturation_; |
| 64 |
| 65 TabContentManager* tab_content_manager_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(ContentLayer); |
| 68 }; |
| 69 |
| 70 } // namespace android |
| 71 } // namespace chrome |
| 72 |
| 73 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CONTENT_LAYER_H_ |
OLD | NEW |