OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/android/view_android.h" | 5 #include "ui/android/view_android.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 void ViewAndroid::AddChild(ViewAndroid* child) { | 35 void ViewAndroid::AddChild(ViewAndroid* child) { |
36 DCHECK(child); | 36 DCHECK(child); |
37 DCHECK(child->window_ == nullptr) << "Children shouldn't have a root window"; | 37 DCHECK(child->window_ == nullptr) << "Children shouldn't have a root window"; |
38 DCHECK(std::find(children_.begin(), children_.end(), child) == | 38 DCHECK(std::find(children_.begin(), children_.end(), child) == |
39 children_.end()); | 39 children_.end()); |
40 | 40 |
41 children_.push_back(child); | 41 children_.push_back(child); |
42 if (child->parent_) | 42 if (child->parent_) |
43 parent_->RemoveChild(child); | 43 child->parent_->RemoveChild(child); |
44 child->parent_ = this; | 44 child->parent_ = this; |
45 } | 45 } |
46 | 46 |
47 void ViewAndroid::RemoveChild(ViewAndroid* child) { | 47 void ViewAndroid::RemoveChild(ViewAndroid* child) { |
48 DCHECK(child); | 48 DCHECK(child); |
49 DCHECK_EQ(child->parent_, this); | 49 DCHECK_EQ(child->parent_, this); |
50 | 50 |
51 std::list<ViewAndroid*>::iterator it = | 51 std::list<ViewAndroid*>::iterator it = |
52 std::find(children_.begin(), children_.end(), child); | 52 std::find(children_.begin(), children_.end(), child); |
53 DCHECK(it != children_.end()); | 53 DCHECK(it != children_.end()); |
(...skipping 23 matching lines...) Expand all Loading... |
77 | 77 |
78 cc::Layer* ViewAndroid::GetLayer() const { | 78 cc::Layer* ViewAndroid::GetLayer() const { |
79 return layer_.get(); | 79 return layer_.get(); |
80 } | 80 } |
81 | 81 |
82 void ViewAndroid::SetLayer(scoped_refptr<cc::Layer> layer) { | 82 void ViewAndroid::SetLayer(scoped_refptr<cc::Layer> layer) { |
83 layer_ = layer; | 83 layer_ = layer; |
84 } | 84 } |
85 | 85 |
86 } // namespace ui | 86 } // namespace ui |
OLD | NEW |