| 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 #include "chrome/browser/android/compositor/layer/content_layer.h" | 5 #include "chrome/browser/android/compositor/layer/content_layer.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/layer_lists.h" | 9 #include "cc/layers/layer_lists.h" |
| 10 #include "cc/layers/layer_settings.h" | |
| 11 #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" | 10 #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" |
| 12 #include "chrome/browser/android/compositor/tab_content_manager.h" | 11 #include "chrome/browser/android/compositor/tab_content_manager.h" |
| 13 #include "content/public/browser/android/compositor.h" | 12 #include "content/public/browser/android/compositor.h" |
| 14 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 15 | 14 |
| 16 namespace chrome { | 15 namespace chrome { |
| 17 namespace android { | 16 namespace android { |
| 18 | 17 |
| 19 // static | 18 // static |
| 20 scoped_refptr<ContentLayer> ContentLayer::Create( | 19 scoped_refptr<ContentLayer> ContentLayer::Create( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 if (content_attached_ && DoesLeafDrawContents(layer()->children()[0])) | 138 if (content_attached_ && DoesLeafDrawContents(layer()->children()[0])) |
| 140 return layer_->children()[0]->bounds(); | 139 return layer_->children()[0]->bounds(); |
| 141 return gfx::Size(0, 0); | 140 return gfx::Size(0, 0); |
| 142 } | 141 } |
| 143 | 142 |
| 144 scoped_refptr<cc::Layer> ContentLayer::layer() { | 143 scoped_refptr<cc::Layer> ContentLayer::layer() { |
| 145 return layer_; | 144 return layer_; |
| 146 } | 145 } |
| 147 | 146 |
| 148 ContentLayer::ContentLayer(TabContentManager* tab_content_manager) | 147 ContentLayer::ContentLayer(TabContentManager* tab_content_manager) |
| 149 : layer_(cc::Layer::Create(cc::LayerSettings())), | 148 : layer_(cc::Layer::Create()), |
| 150 content_attached_(false), | 149 content_attached_(false), |
| 151 static_attached_(false), | 150 static_attached_(false), |
| 152 tab_content_manager_(tab_content_manager) { | 151 tab_content_manager_(tab_content_manager) {} |
| 153 } | |
| 154 | 152 |
| 155 ContentLayer::~ContentLayer() { | 153 ContentLayer::~ContentLayer() { |
| 156 } | 154 } |
| 157 | 155 |
| 158 void ContentLayer::SetContentLayer(scoped_refptr<cc::Layer> layer) { | 156 void ContentLayer::SetContentLayer(scoped_refptr<cc::Layer> layer) { |
| 159 // Check indices | 157 // Check indices |
| 160 // content_attached_, expect at least 1 child. | 158 // content_attached_, expect at least 1 child. |
| 161 DCHECK(!content_attached_ || layer_->children().size() > 0); | 159 DCHECK(!content_attached_ || layer_->children().size() > 0); |
| 162 | 160 |
| 163 if (!layer.get()) { | 161 if (!layer.get()) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 218 |
| 221 void ContentLayer::ClipStaticLayer(scoped_refptr<ThumbnailLayer> static_layer, | 219 void ContentLayer::ClipStaticLayer(scoped_refptr<ThumbnailLayer> static_layer, |
| 222 gfx::Rect clipping) { | 220 gfx::Rect clipping) { |
| 223 if (!static_layer.get()) | 221 if (!static_layer.get()) |
| 224 return; | 222 return; |
| 225 static_layer->Clip(clipping); | 223 static_layer->Clip(clipping); |
| 226 } | 224 } |
| 227 | 225 |
| 228 } // namespace android | 226 } // namespace android |
| 229 } // namespace chrome | 227 } // namespace chrome |
| OLD | NEW |