OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/test/fake_painted_scrollbar_layer.h" | 5 #include "cc/test/fake_painted_scrollbar_layer.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/memory/ptr_util.h" |
8 #include "cc/test/fake_scrollbar.h" | 9 #include "cc/test/fake_scrollbar.h" |
9 | 10 |
10 namespace cc { | 11 namespace cc { |
11 | 12 |
12 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( | 13 scoped_refptr<FakePaintedScrollbarLayer> FakePaintedScrollbarLayer::Create( |
13 bool paint_during_update, | 14 bool paint_during_update, |
14 bool has_thumb, | 15 bool has_thumb, |
15 int scrolling_layer_id) { | 16 int scrolling_layer_id) { |
16 FakeScrollbar* fake_scrollbar = new FakeScrollbar( | 17 FakeScrollbar* fake_scrollbar = new FakeScrollbar( |
17 paint_during_update, has_thumb, false); | 18 paint_during_update, has_thumb, false); |
18 return make_scoped_refptr( | 19 return make_scoped_refptr( |
19 new FakePaintedScrollbarLayer(fake_scrollbar, scrolling_layer_id)); | 20 new FakePaintedScrollbarLayer(fake_scrollbar, scrolling_layer_id)); |
20 } | 21 } |
21 | 22 |
22 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer( | 23 FakePaintedScrollbarLayer::FakePaintedScrollbarLayer( |
23 FakeScrollbar* fake_scrollbar, | 24 FakeScrollbar* fake_scrollbar, |
24 int scrolling_layer_id) | 25 int scrolling_layer_id) |
25 : PaintedScrollbarLayer(scoped_ptr<Scrollbar>(fake_scrollbar), | 26 : PaintedScrollbarLayer(std::unique_ptr<Scrollbar>(fake_scrollbar), |
26 scrolling_layer_id), | 27 scrolling_layer_id), |
27 update_count_(0), | 28 update_count_(0), |
28 push_properties_count_(0), | 29 push_properties_count_(0), |
29 fake_scrollbar_(fake_scrollbar) { | 30 fake_scrollbar_(fake_scrollbar) { |
30 SetBounds(gfx::Size(1, 1)); | 31 SetBounds(gfx::Size(1, 1)); |
31 SetIsDrawable(true); | 32 SetIsDrawable(true); |
32 } | 33 } |
33 | 34 |
34 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {} | 35 FakePaintedScrollbarLayer::~FakePaintedScrollbarLayer() {} |
35 | 36 |
36 bool FakePaintedScrollbarLayer::Update() { | 37 bool FakePaintedScrollbarLayer::Update() { |
37 bool updated = PaintedScrollbarLayer::Update(); | 38 bool updated = PaintedScrollbarLayer::Update(); |
38 ++update_count_; | 39 ++update_count_; |
39 return updated; | 40 return updated; |
40 } | 41 } |
41 | 42 |
42 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { | 43 void FakePaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { |
43 PaintedScrollbarLayer::PushPropertiesTo(layer); | 44 PaintedScrollbarLayer::PushPropertiesTo(layer); |
44 ++push_properties_count_; | 45 ++push_properties_count_; |
45 } | 46 } |
46 | 47 |
47 scoped_ptr<base::AutoReset<bool>> | 48 std::unique_ptr<base::AutoReset<bool>> |
48 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() { | 49 FakePaintedScrollbarLayer::IgnoreSetNeedsCommit() { |
49 return make_scoped_ptr( | 50 return base::WrapUnique( |
50 new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); | 51 new base::AutoReset<bool>(&ignore_set_needs_commit_, true)); |
51 } | 52 } |
52 | 53 |
53 } // namespace cc | 54 } // namespace cc |
OLD | NEW |