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

Side by Side Diff: content/browser/web_contents/aura/overscroll_layer_wrapper.cc

Issue 895543005: Refactor GestureNavigation to eliminate code redundancy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Checked comments Created 5 years, 9 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/web_contents/aura/overscroll_layer_wrapper.h"
6
7 #include "content/browser/web_contents/aura/shadow_layer_delegate.h"
8 #include "ui/aura/window.h"
9 #include "ui/compositor/layer.h"
10
11 namespace content {
12
13 OverscrollLayerWrapper::OverscrollLayerWrapper()
14 : layer_(nullptr),
15 window_(nullptr),
16 shadow_(nullptr) {
17 }
18
19 OverscrollLayerWrapper::~OverscrollLayerWrapper() {
20 }
21
22 void OverscrollLayerWrapper::WrapWindow(aura::Window* window) {
23 DCHECK(!window_);
24 DCHECK(!layer_);
25 window_ = window;
26 shadow_.reset(new ShadowLayerDelegate(window_->layer()));
27 }
28
29 void OverscrollLayerWrapper::WrapLayer(ui::Layer* layer) {
30 DCHECK(!window_);
31 DCHECK(!layer_);
32 layer_ = layer;
33 shadow_.reset(new ShadowLayerDelegate(layer));
34 }
35
36 void OverscrollLayerWrapper::SetTransform(const gfx::Transform& transform) {
37 if (layer_) {
38 layer_->SetTransform(transform);
39 return;
40 }
41 DCHECK(window_);
42 window_->SetTransform(transform);
43 }
44
45 void OverscrollLayerWrapper::SetBounds(const gfx::Rect& bounds) {
46 if (layer_) {
47 layer_->SetBounds(bounds);
48 return;
49 }
50 DCHECK(window_);
51 window_->SetBounds(bounds);
52 }
53
54 ui::LayerAnimator* OverscrollLayerWrapper::GetAnimator() {
55 if (layer_)
56 return layer_->GetAnimator();
57 DCHECK(window_);
58 return window_->layer()->GetAnimator();
59 }
60
61 gfx::Rect OverscrollLayerWrapper::GetBounds() {
62 if (layer_)
63 return layer_->bounds();
64 DCHECK(window_);
65 return window_->bounds();
66 }
67
68 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698