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

Side by Side Diff: cc/input/top_controls_manager.cc

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/input/top_controls_manager.h ('k') | cc/input/top_controls_manager_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "cc/input/top_controls_manager.h" 5 #include "cc/input/top_controls_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h"
12 #include "cc/animation/keyframed_animation_curve.h" 13 #include "cc/animation/keyframed_animation_curve.h"
13 #include "cc/animation/timing_function.h" 14 #include "cc/animation/timing_function.h"
14 #include "cc/input/top_controls_manager_client.h" 15 #include "cc/input/top_controls_manager_client.h"
15 #include "cc/output/begin_frame_args.h" 16 #include "cc/output/begin_frame_args.h"
16 #include "cc/trees/layer_tree_impl.h" 17 #include "cc/trees/layer_tree_impl.h"
17 #include "ui/gfx/geometry/vector2d_f.h" 18 #include "ui/gfx/geometry/vector2d_f.h"
18 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
19 20
20 namespace cc { 21 namespace cc {
21 namespace { 22 namespace {
22 // These constants were chosen empirically for their visually pleasant behavior. 23 // These constants were chosen empirically for their visually pleasant behavior.
23 // Contact tedchoc@chromium.org for questions about changing these values. 24 // Contact tedchoc@chromium.org for questions about changing these values.
24 const int64_t kShowHideMaxDurationMs = 200; 25 const int64_t kShowHideMaxDurationMs = 200;
25 } 26 }
26 27
27 // static 28 // static
28 scoped_ptr<TopControlsManager> TopControlsManager::Create( 29 std::unique_ptr<TopControlsManager> TopControlsManager::Create(
29 TopControlsManagerClient* client, 30 TopControlsManagerClient* client,
30 float top_controls_show_threshold, 31 float top_controls_show_threshold,
31 float top_controls_hide_threshold) { 32 float top_controls_hide_threshold) {
32 return make_scoped_ptr(new TopControlsManager(client, 33 return base::WrapUnique(new TopControlsManager(
33 top_controls_show_threshold, 34 client, top_controls_show_threshold, top_controls_hide_threshold));
34 top_controls_hide_threshold));
35 } 35 }
36 36
37 TopControlsManager::TopControlsManager(TopControlsManagerClient* client, 37 TopControlsManager::TopControlsManager(TopControlsManagerClient* client,
38 float top_controls_show_threshold, 38 float top_controls_show_threshold,
39 float top_controls_hide_threshold) 39 float top_controls_hide_threshold)
40 : client_(client), 40 : client_(client),
41 animation_direction_(NO_ANIMATION), 41 animation_direction_(NO_ANIMATION),
42 permitted_state_(BOTH), 42 permitted_state_(BOTH),
43 accumulated_scroll_delta_(0.f), 43 accumulated_scroll_delta_(0.f),
44 baseline_content_offset_(0.f), 44 baseline_content_offset_(0.f),
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) || 226 return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) ||
227 (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f); 227 (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f);
228 } 228 }
229 229
230 void TopControlsManager::ResetBaseline() { 230 void TopControlsManager::ResetBaseline() {
231 accumulated_scroll_delta_ = 0.f; 231 accumulated_scroll_delta_ = 0.f;
232 baseline_content_offset_ = ContentTopOffset(); 232 baseline_content_offset_ = ContentTopOffset();
233 } 233 }
234 234
235 } // namespace cc 235 } // namespace cc
OLDNEW
« no previous file with comments | « cc/input/top_controls_manager.h ('k') | cc/input/top_controls_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698