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/thumbnail_layer.h" | 5 #include "chrome/browser/android/compositor/layer/thumbnail_layer.h" |
6 | 6 |
7 #include "cc/layers/ui_resource_layer.h" | 7 #include "cc/layers/ui_resource_layer.h" |
| 8 #include "chrome/browser/android/compositor/layer/content_layer.h" |
8 #include "chrome/browser/android/thumbnail/thumbnail.h" | 9 #include "chrome/browser/android/thumbnail/thumbnail.h" |
9 #include "ui/gfx/geometry/size_conversions.h" | 10 #include "ui/gfx/geometry/size_conversions.h" |
10 | 11 |
11 namespace chrome { | 12 namespace chrome { |
12 namespace android { | 13 namespace android { |
13 | 14 |
14 // static | 15 // static |
15 scoped_refptr<ThumbnailLayer> ThumbnailLayer::Create() { | 16 scoped_refptr<ThumbnailLayer> ThumbnailLayer::Create() { |
16 return make_scoped_refptr(new ThumbnailLayer()); | 17 return make_scoped_refptr(new ThumbnailLayer()); |
17 } | 18 } |
(...skipping 24 matching lines...) Expand all Loading... |
42 if (index >= parent->children().size()) | 43 if (index >= parent->children().size()) |
43 parent->AddChild(layer_); | 44 parent->AddChild(layer_); |
44 else if (parent->child_at(index)->id() != layer_->id()) | 45 else if (parent->child_at(index)->id() != layer_->id()) |
45 parent->ReplaceChild(parent->child_at(index), layer_); | 46 parent->ReplaceChild(parent->child_at(index), layer_); |
46 } | 47 } |
47 | 48 |
48 scoped_refptr<cc::Layer> ThumbnailLayer::layer() { | 49 scoped_refptr<cc::Layer> ThumbnailLayer::layer() { |
49 return layer_; | 50 return layer_; |
50 } | 51 } |
51 | 52 |
52 ThumbnailLayer::ThumbnailLayer() : layer_(cc::UIResourceLayer::Create()) { | 53 ThumbnailLayer::ThumbnailLayer() |
| 54 : layer_( |
| 55 cc::UIResourceLayer::Create(ContentLayer::ContentLayerSettings())) { |
53 layer_->SetIsDrawable(true); | 56 layer_->SetIsDrawable(true); |
54 } | 57 } |
55 | 58 |
56 ThumbnailLayer::~ThumbnailLayer() { | 59 ThumbnailLayer::~ThumbnailLayer() { |
57 } | 60 } |
58 | 61 |
59 void ThumbnailLayer::UpdateSizes(const gfx::SizeF& content_size, | 62 void ThumbnailLayer::UpdateSizes(const gfx::SizeF& content_size, |
60 const gfx::SizeF& resource_size) { | 63 const gfx::SizeF& resource_size) { |
61 if (content_size != content_size_ || resource_size != resource_size_) { | 64 if (content_size != content_size_ || resource_size != resource_size_) { |
62 content_size_ = content_size; | 65 content_size_ = content_size; |
63 resource_size_ = resource_size; | 66 resource_size_ = resource_size; |
64 Clip(last_clipping_); | 67 Clip(last_clipping_); |
65 } | 68 } |
66 } | 69 } |
67 | 70 |
68 } // namespace android | 71 } // namespace android |
69 } // namespace chrome | 72 } // namespace chrome |
OLD | NEW |