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

Side by Side Diff: cc/layers/viewport.h

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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
« no previous file with comments | « cc/layers/video_layer_impl_unittest.cc ('k') | cc/layers/viewport.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef CC_LAYERS_VIEWPORT_H_ 5 #ifndef CC_LAYERS_VIEWPORT_H_
6 #define CC_LAYERS_VIEWPORT_H_ 6 #define CC_LAYERS_VIEWPORT_H_
7 7
8 #include <memory>
9
8 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/layers/layer_impl.h" 12 #include "cc/layers/layer_impl.h"
12 #include "ui/gfx/geometry/vector2d_f.h" 13 #include "ui/gfx/geometry/vector2d_f.h"
13 14
14 namespace cc { 15 namespace cc {
15 16
16 class LayerTreeHostImpl; 17 class LayerTreeHostImpl;
17 18
18 // Encapsulates gesture handling logic on the viewport layers. The "viewport" 19 // Encapsulates gesture handling logic on the viewport layers. The "viewport"
19 // is made up of two scrolling layers, the inner viewport (visual) and the 20 // is made up of two scrolling layers, the inner viewport (visual) and the
20 // outer viewport (layout) scroll layers. These layers have different scroll 21 // outer viewport (layout) scroll layers. These layers have different scroll
21 // bubbling behavior from the rest of the layer tree which is encoded in this 22 // bubbling behavior from the rest of the layer tree which is encoded in this
22 // class. 23 // class.
23 class CC_EXPORT Viewport { 24 class CC_EXPORT Viewport {
24 public: 25 public:
25 // If the pinch zoom anchor on the first PinchUpdate is within this length 26 // If the pinch zoom anchor on the first PinchUpdate is within this length
26 // of the screen edge, "snap" the zoom to that edge. Experimentally 27 // of the screen edge, "snap" the zoom to that edge. Experimentally
27 // determined. 28 // determined.
28 static const int kPinchZoomSnapMarginDips = 100; 29 static const int kPinchZoomSnapMarginDips = 100;
29 30
30 // TODO(tdresser): eventually |consumed_delta| should equal 31 // TODO(tdresser): eventually |consumed_delta| should equal
31 // |content_scrolled_delta|. See crbug.com/510045 for details. 32 // |content_scrolled_delta|. See crbug.com/510045 for details.
32 struct ScrollResult { 33 struct ScrollResult {
33 gfx::Vector2dF consumed_delta; 34 gfx::Vector2dF consumed_delta;
34 gfx::Vector2dF content_scrolled_delta; 35 gfx::Vector2dF content_scrolled_delta;
35 }; 36 };
36 37
37 static scoped_ptr<Viewport> Create(LayerTreeHostImpl* host_impl); 38 static std::unique_ptr<Viewport> Create(LayerTreeHostImpl* host_impl);
38 39
39 // Differs from scrolling in that only the visual viewport is moved, without 40 // Differs from scrolling in that only the visual viewport is moved, without
40 // affecting the top controls or outer viewport. 41 // affecting the top controls or outer viewport.
41 void Pan(const gfx::Vector2dF& delta); 42 void Pan(const gfx::Vector2dF& delta);
42 43
43 // Scrolls the viewport, applying the unique bubbling between the inner and 44 // Scrolls the viewport, applying the unique bubbling between the inner and
44 // outer viewport. Scrolls can be consumed by top controls. 45 // outer viewport. Scrolls can be consumed by top controls.
45 ScrollResult ScrollBy(const gfx::Vector2dF& delta, 46 ScrollResult ScrollBy(const gfx::Vector2dF& delta,
46 const gfx::Point& viewport_point, 47 const gfx::Point& viewport_point,
47 bool is_wheel_scroll, 48 bool is_wheel_scroll,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 gfx::Vector2d pinch_anchor_adjustment_; 84 gfx::Vector2d pinch_anchor_adjustment_;
84 85
85 FRIEND_TEST_ALL_PREFIXES(ViewportTest, ShouldAnimateViewport); 86 FRIEND_TEST_ALL_PREFIXES(ViewportTest, ShouldAnimateViewport);
86 87
87 DISALLOW_COPY_AND_ASSIGN(Viewport); 88 DISALLOW_COPY_AND_ASSIGN(Viewport);
88 }; 89 };
89 90
90 } // namespace cc 91 } // namespace cc
91 92
92 #endif // CC_LAYERS_VIEWPORT_H_ 93 #endif // CC_LAYERS_VIEWPORT_H_
OLDNEW
« no previous file with comments | « cc/layers/video_layer_impl_unittest.cc ('k') | cc/layers/viewport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698