Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: content/browser/web_contents/aura/overscroll_layer_wrapper.h

Issue 895543005: Refactor GestureNavigation to eliminate code redundancy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Mikhail's comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_OVERSCROLL_LAYER_WRAPPER_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_LAYER_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/image/image.h"
12 #include "ui/gfx/transform.h"
13
14 namespace ui {
15 class Layer;
16 class LayerAnimator;
17 }
18
19 namespace content {
20
21 class ImageLayerDelegate;
22 class ShadowLayerDelegate;
23
24 // Wraps a window or a layer, exposing some of their common API to allow
25 // overscroll animations for both cases. If wrapping a layer, assumes its
26 // ownership.
27 class OverscrollLayerWrapper {
28 public:
29 // Takes a pointer to the |window|.
30 explicit OverscrollLayerWrapper(scoped_ptr<aura::Window> window);
31
32 // Assumes ownership of the |layer|.
33 explicit OverscrollLayerWrapper(scoped_ptr<ui::Layer> layer);
34
35 ~OverscrollLayerWrapper();
36
37 // Returns the wrapped |layer_| or the |window_| layer.
38 ui::Layer* layer() { return layer_ ? layer_.get() : window_->layer(); }
39
40 // Returns true if a window is being wrapped.
41 bool has_window() { return !!window_; }
42
43 // Transfers ownership of the wrapped |layer_|.
44 scoped_ptr<ui::Layer> AcquireLayer();
45
46 // Transfers ownership of the wrapped |window_|.
47 scoped_ptr<aura::Window> AcquireWindow();
48
49 // Returns the wrapped target layer bounds.
50 gfx::Rect GetBounds();
51
52 private:
53 // The wrapped layer.
54 scoped_ptr<ui::Layer> layer_;
55
56 // The wrapped window.
57 scoped_ptr<aura::Window> window_;
58 };
59
60 } // namespace content
61
62 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_LAYER_WRAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698