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

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

Issue 2528823002: Separate SwipeRefreshHandler and ContentViewCore (Closed)
Patch Set: Fix compile error in test case Created 4 years 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 "base/memory/ptr_util.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 80 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
81 switches::kDisableOverscrollEdgeEffect)) { 81 switches::kDisableOverscrollEdgeEffect)) {
82 return nullptr; 82 return nullptr;
83 } 83 }
84 84
85 return base::MakeUnique<OverscrollGlow>(client); 85 return base::MakeUnique<OverscrollGlow>(client);
86 } 86 }
87 87
88 std::unique_ptr<OverscrollRefresh> CreateRefreshEffect( 88 std::unique_ptr<OverscrollRefresh> CreateRefreshEffect(
89 OverscrollRefreshHandler* handler) { 89 OverscrollRefreshHandler* handler) {
90 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 90 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
Jinsuk Kim 2016/11/25 01:49:18 Now that OverscrollRefreshHandler is not CVC but a
rlanday 2016/11/29 00:46:25 Sorry, I missed this comment before---I suppose we
rlanday 2016/11/30 00:18:33 I think this discussion is now moot with the lates
91 switches::kDisablePullToRefreshEffect)) { 91 switches::kDisablePullToRefreshEffect)) {
92 return nullptr; 92 return nullptr;
93 } 93 }
94 94
95 return base::MakeUnique<OverscrollRefresh>(handler); 95 return base::MakeUnique<OverscrollRefresh>(handler);
96 } 96 }
97 97
98 } // namespace 98 } // namespace
99 99
100 OverscrollControllerAndroid::OverscrollControllerAndroid( 100 OverscrollControllerAndroid::OverscrollControllerAndroid(
101 ContentViewCoreImpl* content_view_core, 101 ContentViewCoreImpl* content_view_core,
102 OverscrollRefreshHandler* overscroll_refresh_handler,
102 float dpi_scale) 103 float dpi_scale)
103 : compositor_(content_view_core->GetWindowAndroid()->GetCompositor()), 104 : compositor_(content_view_core->GetWindowAndroid()->GetCompositor()),
Jinsuk Kim 2016/11/25 01:49:18 Now you can pass the compositor object directly -
rlanday 2016/11/29 00:46:25 Done
104 dpi_scale_(dpi_scale), 105 dpi_scale_(dpi_scale),
105 enabled_(true), 106 enabled_(true),
106 glow_effect_(CreateGlowEffect(this, dpi_scale_)), 107 glow_effect_(CreateGlowEffect(this, dpi_scale_)) {
107 refresh_effect_(CreateRefreshEffect(content_view_core)) { 108 if (overscroll_refresh_handler) {
109 refresh_effect_ = CreateRefreshEffect(overscroll_refresh_handler);
Jinsuk Kim 2016/11/25 01:49:18 How about keep this intact but update CreateRefres
rlanday 2016/11/29 00:46:25 Done
110 }
108 DCHECK(compositor_); 111 DCHECK(compositor_);
109 } 112 }
110 113
111 OverscrollControllerAndroid::~OverscrollControllerAndroid() { 114 OverscrollControllerAndroid::~OverscrollControllerAndroid() {
112 } 115 }
113 116
114 bool OverscrollControllerAndroid::WillHandleGestureEvent( 117 bool OverscrollControllerAndroid::WillHandleGestureEvent(
115 const blink::WebGestureEvent& event) { 118 const blink::WebGestureEvent& event) {
116 if (!enabled_) 119 if (!enabled_)
117 return false; 120 return false;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 std::unique_ptr<EdgeEffectBase> 277 std::unique_ptr<EdgeEffectBase>
275 OverscrollControllerAndroid::CreateEdgeEffect() { 278 OverscrollControllerAndroid::CreateEdgeEffect() {
276 return CreateGlowEdgeEffect(&compositor_->GetResourceManager(), dpi_scale_); 279 return CreateGlowEdgeEffect(&compositor_->GetResourceManager(), dpi_scale_);
277 } 280 }
278 281
279 void OverscrollControllerAndroid::SetNeedsAnimate() { 282 void OverscrollControllerAndroid::SetNeedsAnimate() {
280 compositor_->SetNeedsAnimate(); 283 compositor_->SetNeedsAnimate();
281 } 284 }
282 285
283 } // namespace content 286 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698