| 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/layer_settings.h" |
| 7 #include "cc/layers/ui_resource_layer.h" | 8 #include "cc/layers/ui_resource_layer.h" |
| 8 #include "chrome/browser/android/thumbnail/thumbnail.h" | 9 #include "chrome/browser/android/thumbnail/thumbnail.h" |
| 9 #include "content/public/browser/android/compositor.h" | 10 #include "content/public/browser/android/compositor.h" |
| 10 #include "ui/gfx/geometry/size_conversions.h" | 11 #include "ui/gfx/geometry/size_conversions.h" |
| 11 | 12 |
| 12 namespace chrome { | 13 namespace chrome { |
| 13 namespace android { | 14 namespace android { |
| 14 | 15 |
| 15 // static | 16 // static |
| 16 scoped_refptr<ThumbnailLayer> ThumbnailLayer::Create() { | 17 scoped_refptr<ThumbnailLayer> ThumbnailLayer::Create() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 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() | 53 ThumbnailLayer::ThumbnailLayer() |
| 53 : layer_( | 54 : layer_( |
| 54 cc::UIResourceLayer::Create(content::Compositor::LayerSettings())) { | 55 cc::UIResourceLayer::Create(cc::LayerSettings())) { |
| 55 layer_->SetIsDrawable(true); | 56 layer_->SetIsDrawable(true); |
| 56 } | 57 } |
| 57 | 58 |
| 58 ThumbnailLayer::~ThumbnailLayer() { | 59 ThumbnailLayer::~ThumbnailLayer() { |
| 59 } | 60 } |
| 60 | 61 |
| 61 void ThumbnailLayer::UpdateSizes(const gfx::SizeF& content_size, | 62 void ThumbnailLayer::UpdateSizes(const gfx::SizeF& content_size, |
| 62 const gfx::SizeF& resource_size) { | 63 const gfx::SizeF& resource_size) { |
| 63 if (content_size != content_size_ || resource_size != resource_size_) { | 64 if (content_size != content_size_ || resource_size != resource_size_) { |
| 64 content_size_ = content_size; | 65 content_size_ = content_size; |
| 65 resource_size_ = resource_size; | 66 resource_size_ = resource_size; |
| 66 Clip(last_clipping_); | 67 Clip(last_clipping_); |
| 67 } | 68 } |
| 68 } | 69 } |
| 69 | 70 |
| 70 } // namespace android | 71 } // namespace android |
| 71 } // namespace chrome | 72 } // namespace chrome |
| OLD | NEW |