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

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

Issue 628333003: Remove implicit conversions from scoped_refptr to T* in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/browser/android/overscroll_glow.h" 5 #include "content/browser/android/overscroll_glow.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "content/browser/android/edge_effect_base.h" 8 #include "content/browser/android/edge_effect_base.h"
9 9
10 using std::max; 10 using std::max;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return false; 179 return false;
180 for (size_t i = 0; i < EDGE_COUNT; ++i) { 180 for (size_t i = 0; i < EDGE_COUNT; ++i) {
181 if (!edge_effects_[i]->IsFinished()) 181 if (!edge_effects_[i]->IsFinished())
182 return true; 182 return true;
183 } 183 }
184 return false; 184 return false;
185 } 185 }
186 186
187 void OverscrollGlow::UpdateLayerAttachment(cc::Layer* parent) { 187 void OverscrollGlow::UpdateLayerAttachment(cc::Layer* parent) {
188 DCHECK(parent); 188 DCHECK(parent);
189 if (!root_layer_) 189 if (!root_layer_.get())
190 return; 190 return;
191 191
192 if (!NeedsAnimate()) { 192 if (!NeedsAnimate()) {
193 Detach(); 193 Detach();
194 return; 194 return;
195 } 195 }
196 196
197 if (root_layer_->parent() != parent) 197 if (root_layer_->parent() != parent)
198 parent->AddChild(root_layer_); 198 parent->AddChild(root_layer_);
199 199
200 for (size_t i = 0; i < EDGE_COUNT; ++i) 200 for (size_t i = 0; i < EDGE_COUNT; ++i)
201 edge_effects_[i]->SetParent(root_layer_); 201 edge_effects_[i]->SetParent(root_layer_.get());
202 } 202 }
203 203
204 void OverscrollGlow::Detach() { 204 void OverscrollGlow::Detach() {
205 if (root_layer_) 205 if (root_layer_.get())
206 root_layer_->RemoveFromParent(); 206 root_layer_->RemoveFromParent();
207 } 207 }
208 208
209 bool OverscrollGlow::InitializeIfNecessary() { 209 bool OverscrollGlow::InitializeIfNecessary() {
210 DCHECK(enabled_); 210 DCHECK(enabled_);
211 if (initialized_) 211 if (initialized_)
212 return true; 212 return true;
213 213
214 DCHECK(!root_layer_); 214 DCHECK(!root_layer_.get());
215 root_layer_ = cc::Layer::Create(); 215 root_layer_ = cc::Layer::Create();
216 for (size_t i = 0; i < EDGE_COUNT; ++i) { 216 for (size_t i = 0; i < EDGE_COUNT; ++i) {
217 edge_effects_[i] = edge_effect_provider_.Run(); 217 edge_effects_[i] = edge_effect_provider_.Run();
218 DCHECK(edge_effects_[i]); 218 DCHECK(edge_effects_[i]);
219 } 219 }
220 220
221 initialized_ = true; 221 initialized_ = true;
222 return true; 222 return true;
223 } 223 }
224 224
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 EdgeEffectBase* OverscrollGlow::GetOppositeEdge(int edge_index) { 293 EdgeEffectBase* OverscrollGlow::GetOppositeEdge(int edge_index) {
294 DCHECK(initialized_); 294 DCHECK(initialized_);
295 return edge_effects_[(edge_index + 2) % EDGE_COUNT].get(); 295 return edge_effects_[(edge_index + 2) % EDGE_COUNT].get();
296 } 296 }
297 297
298 OverscrollGlow::DisplayParameters::DisplayParameters() { 298 OverscrollGlow::DisplayParameters::DisplayParameters() {
299 edge_offsets[0] = edge_offsets[1] = edge_offsets[2] = edge_offsets[3] = 0.f; 299 edge_offsets[0] = edge_offsets[1] = edge_offsets[2] = edge_offsets[3] = 0.f;
300 } 300 }
301 301
302 } // namespace content 302 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698