OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_SLIDABLE_WRAPPER_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_SLIDABLE_WRAPPER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/aura/window.h" |
| 10 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/gfx/transform.h" |
| 12 |
| 13 namespace ui { |
| 14 class Layer; |
| 15 class LayerAnimator; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 |
| 20 // Wraps a window or a layer, exposing some of their common API to allow |
| 21 // overscroll animations for both cases. For a window, it can either assume its |
| 22 // ownership or not. |
| 23 class SlidableWrapper { |
| 24 public: |
| 25 // Assumes ownership of the |window|. |
| 26 explicit SlidableWrapper(scoped_ptr<aura::Window> window); |
| 27 |
| 28 // Assumes ownership of the |layer|. |
| 29 explicit SlidableWrapper(scoped_ptr<ui::Layer> layer); |
| 30 |
| 31 ~SlidableWrapper(); |
| 32 |
| 33 // Returns a pointer to the underlying layer. |
| 34 ui::Layer* GetLayer(); |
| 35 |
| 36 // Transfers ownership of the wrapped and owned |layer_|. |
| 37 scoped_ptr<ui::Layer> AcquireLayer(); |
| 38 |
| 39 // Transfers ownership of the wrapped and owned |owned_window_|. |
| 40 scoped_ptr<aura::Window> AcquireWindow(); |
| 41 |
| 42 // Returns the wrapped target bounds. |
| 43 gfx::Rect GetBounds(); |
| 44 |
| 45 // Sets the wrapped target bounds. |
| 46 void SetBounds(const gfx::Rect& bounds); |
| 47 |
| 48 private: |
| 49 // The wrapped layer. |
| 50 scoped_ptr<ui::Layer> layer_; |
| 51 |
| 52 // The wrapped and window. |
| 53 scoped_ptr<aura::Window> window_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(SlidableWrapper); |
| 56 }; |
| 57 |
| 58 } // namespace content |
| 59 |
| 60 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_SLIDABLE_WRAPPER_H_ |
OLD | NEW |