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

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

Issue 747683002: [Android] Clean up for UIResourceLayer use in EffectLayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | content/browser/android/edge_effect_l.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 (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/edge_effect.h" 5 #include "content/browser/android/edge_effect.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "cc/layers/ui_resource_layer.h" 8 #include "cc/layers/ui_resource_layer.h"
9 #include "content/browser/android/animation_utils.h" 9 #include "content/browser/android/animation_utils.h"
10 #include "ui/base/android/system_ui_resource_manager.h" 10 #include "ui/base/android/system_ui_resource_manager.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 ui::SystemUIResourceManager* resource_manager) 61 ui::SystemUIResourceManager* resource_manager)
62 : ui_resource_layer_(cc::UIResourceLayer::Create()), 62 : ui_resource_layer_(cc::UIResourceLayer::Create()),
63 resource_type_(resource_type), 63 resource_type_(resource_type),
64 resource_manager_(resource_manager) {} 64 resource_manager_(resource_manager) {}
65 65
66 ~EffectLayer() { ui_resource_layer_->RemoveFromParent(); } 66 ~EffectLayer() { ui_resource_layer_->RemoveFromParent(); }
67 67
68 void SetParent(cc::Layer* parent) { 68 void SetParent(cc::Layer* parent) {
69 if (ui_resource_layer_->parent() != parent) 69 if (ui_resource_layer_->parent() != parent)
70 parent->AddChild(ui_resource_layer_); 70 parent->AddChild(ui_resource_layer_);
71 ui_resource_layer_->SetUIResourceId(
72 resource_manager_->GetUIResourceId(resource_type_));
73 } 71 }
74 72
75 void Disable() { ui_resource_layer_->SetIsDrawable(false); } 73 void Disable() { ui_resource_layer_->SetIsDrawable(false); }
76 74
77 void Update(const gfx::Size& size, 75 void Update(const gfx::Size& size,
78 const gfx::Transform& transform, 76 const gfx::Transform& transform,
79 float opacity) { 77 float opacity) {
80 ui_resource_layer_->SetUIResourceId( 78 ui_resource_layer_->SetUIResourceId(
81 resource_manager_->GetUIResourceId(resource_type_)); 79 resource_manager_->GetUIResourceId(resource_type_));
82 ui_resource_layer_->SetIsDrawable(true); 80 ui_resource_layer_->SetIsDrawable(true);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 336
339 // static 337 // static
340 void EdgeEffect::PreloadResources( 338 void EdgeEffect::PreloadResources(
341 ui::SystemUIResourceManager* resource_manager) { 339 ui::SystemUIResourceManager* resource_manager) {
342 DCHECK(resource_manager); 340 DCHECK(resource_manager);
343 resource_manager->PreloadResource(ui::OVERSCROLL_EDGE); 341 resource_manager->PreloadResource(ui::OVERSCROLL_EDGE);
344 resource_manager->PreloadResource(ui::OVERSCROLL_GLOW); 342 resource_manager->PreloadResource(ui::OVERSCROLL_GLOW);
345 } 343 }
346 344
347 } // namespace content 345 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/edge_effect_l.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698