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

Side by Side Diff: content/browser/android/overscroll_controller_android.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/android/overscroll_controller_android.h" 5 #include "content/browser/android/overscroll_controller_android.h"
6 6
7 #include "base/android/build_info.h" 7 #include "base/android/build_info.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/ptr_util.h"
9 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
10 #include "cc/output/compositor_frame_metadata.h" 11 #include "cc/output/compositor_frame_metadata.h"
11 #include "content/browser/android/content_view_core_impl.h" 12 #include "content/browser/android/content_view_core_impl.h"
12 #include "content/common/input/did_overscroll_params.h" 13 #include "content/common/input/did_overscroll_params.h"
13 #include "content/public/browser/navigation_controller.h" 14 #include "content/public/browser/navigation_controller.h"
14 #include "content/public/browser/user_metrics.h" 15 #include "content/public/browser/user_metrics.h"
15 #include "content/public/common/content_switches.h" 16 #include "content/public/common/content_switches.h"
16 #include "third_party/WebKit/public/web/WebInputEvent.h" 17 #include "third_party/WebKit/public/web/WebInputEvent.h"
17 #include "ui/android/edge_effect.h" 18 #include "ui/android/edge_effect.h"
18 #include "ui/android/edge_effect_l.h" 19 #include "ui/android/edge_effect_l.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 // Android releases can be quite faint, depending on the OEM-supplied 56 // Android releases can be quite faint, depending on the OEM-supplied
56 // overscroll resources, and lasts nearly twice as long. 57 // overscroll resources, and lasts nearly twice as long.
57 if (IsAndroidLOrNewer()) 58 if (IsAndroidLOrNewer())
58 return kMinGlowAlphaToDisableRefreshOnL; 59 return kMinGlowAlphaToDisableRefreshOnL;
59 60
60 // Any value greater than 1 effectively prevents the glow effect from ever 61 // Any value greater than 1 effectively prevents the glow effect from ever
61 // suppressing the refresh effect. 62 // suppressing the refresh effect.
62 return 1.01f; 63 return 1.01f;
63 } 64 }
64 65
65 scoped_ptr<EdgeEffectBase> CreateGlowEdgeEffect( 66 std::unique_ptr<EdgeEffectBase> CreateGlowEdgeEffect(
66 ui::ResourceManager* resource_manager, 67 ui::ResourceManager* resource_manager,
67 float dpi_scale) { 68 float dpi_scale) {
68 DCHECK(resource_manager); 69 DCHECK(resource_manager);
69 if (IsAndroidLOrNewer()) 70 if (IsAndroidLOrNewer())
70 return scoped_ptr<EdgeEffectBase>(new EdgeEffectL(resource_manager)); 71 return std::unique_ptr<EdgeEffectBase>(new EdgeEffectL(resource_manager));
71 72
72 return scoped_ptr<EdgeEffectBase>( 73 return std::unique_ptr<EdgeEffectBase>(
73 new EdgeEffect(resource_manager, dpi_scale)); 74 new EdgeEffect(resource_manager, dpi_scale));
74 } 75 }
75 76
76 scoped_ptr<OverscrollGlow> CreateGlowEffect(OverscrollGlowClient* client, 77 std::unique_ptr<OverscrollGlow> CreateGlowEffect(OverscrollGlowClient* client,
77 float dpi_scale) { 78 float dpi_scale) {
78 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 79 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
79 switches::kDisableOverscrollEdgeEffect)) { 80 switches::kDisableOverscrollEdgeEffect)) {
80 return nullptr; 81 return nullptr;
81 } 82 }
82 83
83 return make_scoped_ptr(new OverscrollGlow(client)); 84 return base::WrapUnique(new OverscrollGlow(client));
84 } 85 }
85 86
86 scoped_ptr<OverscrollRefresh> CreateRefreshEffect( 87 std::unique_ptr<OverscrollRefresh> CreateRefreshEffect(
87 OverscrollRefreshHandler* handler) { 88 OverscrollRefreshHandler* handler) {
88 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 89 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
89 switches::kDisablePullToRefreshEffect)) { 90 switches::kDisablePullToRefreshEffect)) {
90 return nullptr; 91 return nullptr;
91 } 92 }
92 93
93 return make_scoped_ptr(new OverscrollRefresh(handler)); 94 return base::WrapUnique(new OverscrollRefresh(handler));
94 } 95 }
95 96
96 } // namespace 97 } // namespace
97 98
98 OverscrollControllerAndroid::OverscrollControllerAndroid( 99 OverscrollControllerAndroid::OverscrollControllerAndroid(
99 ContentViewCoreImpl* content_view_core) 100 ContentViewCoreImpl* content_view_core)
100 : compositor_(content_view_core->GetWindowAndroid()->GetCompositor()), 101 : compositor_(content_view_core->GetWindowAndroid()->GetCompositor()),
101 dpi_scale_(content_view_core->GetDpiScale()), 102 dpi_scale_(content_view_core->GetDpiScale()),
102 enabled_(true), 103 enabled_(true),
103 glow_effect_(CreateGlowEffect(this, dpi_scale_)), 104 glow_effect_(CreateGlowEffect(this, dpi_scale_)),
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 return; 262 return;
262 enabled_ = false; 263 enabled_ = false;
263 if (!enabled_) { 264 if (!enabled_) {
264 if (refresh_effect_) 265 if (refresh_effect_)
265 refresh_effect_->Reset(); 266 refresh_effect_->Reset();
266 if (glow_effect_) 267 if (glow_effect_)
267 glow_effect_->Reset(); 268 glow_effect_->Reset();
268 } 269 }
269 } 270 }
270 271
271 scoped_ptr<EdgeEffectBase> OverscrollControllerAndroid::CreateEdgeEffect() { 272 std::unique_ptr<EdgeEffectBase>
273 OverscrollControllerAndroid::CreateEdgeEffect() {
272 return CreateGlowEdgeEffect(&compositor_->GetResourceManager(), dpi_scale_); 274 return CreateGlowEdgeEffect(&compositor_->GetResourceManager(), dpi_scale_);
273 } 275 }
274 276
275 void OverscrollControllerAndroid::SetNeedsAnimate() { 277 void OverscrollControllerAndroid::SetNeedsAnimate() {
276 compositor_->SetNeedsAnimate(); 278 compositor_->SetNeedsAnimate();
277 } 279 }
278 280
279 } // namespace content 281 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/overscroll_controller_android.h ('k') | content/browser/android/popup_touch_handle_drawable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698