| Index: content/browser/web_contents/aura/overscroll_layer_wrapper.h
|
| diff --git a/content/browser/web_contents/aura/overscroll_layer_wrapper.h b/content/browser/web_contents/aura/overscroll_layer_wrapper.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c0ce1bffab86e5ab1ccec0ddb3c33a9e5b9b2511
|
| --- /dev/null
|
| +++ b/content/browser/web_contents/aura/overscroll_layer_wrapper.h
|
| @@ -0,0 +1,62 @@
|
| +// 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.
|
| +
|
| +#ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_LAYER_WRAPPER_H_
|
| +#define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_LAYER_WRAPPER_H_
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "ui/aura/window.h"
|
| +#include "ui/gfx/geometry/rect.h"
|
| +#include "ui/gfx/image/image.h"
|
| +#include "ui/gfx/transform.h"
|
| +
|
| +namespace ui {
|
| +class Layer;
|
| +class LayerAnimator;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +class ImageLayerDelegate;
|
| +class ShadowLayerDelegate;
|
| +
|
| +// Wraps a window or a layer, exposing some of their common API to allow
|
| +// overscroll animations for both cases. If wrapping a layer, assumes its
|
| +// ownership.
|
| +class OverscrollLayerWrapper {
|
| + public:
|
| + // Takes a pointer to the |window|.
|
| + explicit OverscrollLayerWrapper(scoped_ptr<aura::Window> window);
|
| +
|
| + // Assumes ownership of the |layer|.
|
| + explicit OverscrollLayerWrapper(scoped_ptr<ui::Layer> layer);
|
| +
|
| + ~OverscrollLayerWrapper();
|
| +
|
| + // Returns the wrapped |layer_| or the |window_| layer.
|
| + ui::Layer* layer() { return layer_ ? layer_.get() : window_->layer(); }
|
| +
|
| + // Returns true if a window is being wrapped.
|
| + bool has_window() { return !!window_; }
|
| +
|
| + // Transfers ownership of the wrapped |layer_|.
|
| + scoped_ptr<ui::Layer> AcquireLayer();
|
| +
|
| + // Transfers ownership of the wrapped |window_|.
|
| + scoped_ptr<aura::Window> AcquireWindow();
|
| +
|
| + // Returns the wrapped target layer bounds.
|
| + gfx::Rect GetBounds();
|
| +
|
| + private:
|
| + // The wrapped layer.
|
| + scoped_ptr<ui::Layer> layer_;
|
| +
|
| + // The wrapped window.
|
| + scoped_ptr<aura::Window> window_;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_LAYER_WRAPPER_H_
|
|
|