| Index: content/browser/web_contents/aura/overscroll_layer_wrapper.cc
|
| diff --git a/content/browser/web_contents/aura/overscroll_layer_wrapper.cc b/content/browser/web_contents/aura/overscroll_layer_wrapper.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bf3cbce55ccb3e9fc8093327f67edde38bcdf7ae
|
| --- /dev/null
|
| +++ b/content/browser/web_contents/aura/overscroll_layer_wrapper.cc
|
| @@ -0,0 +1,68 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/web_contents/aura/overscroll_layer_wrapper.h"
|
| +
|
| +#include "content/browser/web_contents/aura/shadow_layer_delegate.h"
|
| +#include "ui/aura/window.h"
|
| +#include "ui/compositor/layer.h"
|
| +
|
| +namespace content {
|
| +
|
| +OverscrollLayerWrapper::OverscrollLayerWrapper()
|
| + : layer_(nullptr),
|
| + window_(nullptr),
|
| + shadow_(nullptr) {
|
| +}
|
| +
|
| +OverscrollLayerWrapper::~OverscrollLayerWrapper() {
|
| +}
|
| +
|
| +void OverscrollLayerWrapper::WrapWindow(aura::Window* window) {
|
| + DCHECK(!window_);
|
| + DCHECK(!layer_);
|
| + window_ = window;
|
| + shadow_.reset(new ShadowLayerDelegate(window_->layer()));
|
| +}
|
| +
|
| +void OverscrollLayerWrapper::WrapLayer(ui::Layer* layer) {
|
| + DCHECK(!window_);
|
| + DCHECK(!layer_);
|
| + layer_ = layer;
|
| + shadow_.reset(new ShadowLayerDelegate(layer));
|
| +}
|
| +
|
| +void OverscrollLayerWrapper::SetTransform(const gfx::Transform& transform) {
|
| + if (layer_) {
|
| + layer_->SetTransform(transform);
|
| + return;
|
| + }
|
| + DCHECK(window_);
|
| + window_->SetTransform(transform);
|
| +}
|
| +
|
| +void OverscrollLayerWrapper::SetBounds(const gfx::Rect& bounds) {
|
| + if (layer_) {
|
| + layer_->SetBounds(bounds);
|
| + return;
|
| + }
|
| + DCHECK(window_);
|
| + window_->SetBounds(bounds);
|
| +}
|
| +
|
| +ui::LayerAnimator* OverscrollLayerWrapper::GetAnimator() {
|
| + if (layer_)
|
| + return layer_->GetAnimator();
|
| + DCHECK(window_);
|
| + return window_->layer()->GetAnimator();
|
| +}
|
| +
|
| +gfx::Rect OverscrollLayerWrapper::GetBounds() {
|
| + if (layer_)
|
| + return layer_->bounds();
|
| + DCHECK(window_);
|
| + return window_->bounds();
|
| +}
|
| +
|
| +} // namespace content
|
|
|