| 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 #ifndef CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 5 #ifndef CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| 6 #define CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 6 #define CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/layers/painted_scrollbar_layer.h" | 11 #include "cc/layers/painted_scrollbar_layer.h" |
| 12 #include "cc/test/fake_scrollbar.h" | 12 #include "cc/test/fake_scrollbar.h" |
| 13 | 13 |
| 14 namespace base { template<typename T> class AutoReset; } | 14 namespace base { template<typename T> class AutoReset; } |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 class FakePaintedScrollbarLayer : public PaintedScrollbarLayer { | 18 class FakePaintedScrollbarLayer : public PaintedScrollbarLayer { |
| 19 public: | 19 public: |
| 20 static scoped_refptr<FakePaintedScrollbarLayer> Create( | 20 static scoped_refptr<FakePaintedScrollbarLayer> Create( |
| 21 const LayerSettings& settings, | |
| 22 bool paint_during_update, | 21 bool paint_during_update, |
| 23 bool has_thumb, | 22 bool has_thumb, |
| 24 int scrolling_layer_id); | 23 int scrolling_layer_id); |
| 25 int update_count() const { return update_count_; } | 24 int update_count() const { return update_count_; } |
| 26 void reset_update_count() { update_count_ = 0; } | 25 void reset_update_count() { update_count_ = 0; } |
| 27 | 26 |
| 28 bool Update() override; | 27 bool Update() override; |
| 29 | 28 |
| 30 void PushPropertiesTo(LayerImpl* layer) override; | 29 void PushPropertiesTo(LayerImpl* layer) override; |
| 31 | 30 |
| 32 scoped_ptr<base::AutoReset<bool>> IgnoreSetNeedsCommit(); | 31 scoped_ptr<base::AutoReset<bool>> IgnoreSetNeedsCommit(); |
| 33 | 32 |
| 34 size_t push_properties_count() const { return push_properties_count_; } | 33 size_t push_properties_count() const { return push_properties_count_; } |
| 35 void reset_push_properties_count() { push_properties_count_ = 0; } | 34 void reset_push_properties_count() { push_properties_count_ = 0; } |
| 36 | 35 |
| 37 // For unit tests | 36 // For unit tests |
| 38 UIResourceId track_resource_id() { | 37 UIResourceId track_resource_id() { |
| 39 return PaintedScrollbarLayer::track_resource_id(); | 38 return PaintedScrollbarLayer::track_resource_id(); |
| 40 } | 39 } |
| 41 UIResourceId thumb_resource_id() { | 40 UIResourceId thumb_resource_id() { |
| 42 return PaintedScrollbarLayer::thumb_resource_id(); | 41 return PaintedScrollbarLayer::thumb_resource_id(); |
| 43 } | 42 } |
| 44 FakeScrollbar* fake_scrollbar() { | 43 FakeScrollbar* fake_scrollbar() { |
| 45 return fake_scrollbar_; | 44 return fake_scrollbar_; |
| 46 } | 45 } |
| 47 using PaintedScrollbarLayer::UpdateInternalContentScale; | 46 using PaintedScrollbarLayer::UpdateInternalContentScale; |
| 48 using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; | 47 using PaintedScrollbarLayer::UpdateThumbAndTrackGeometry; |
| 49 | 48 |
| 50 private: | 49 private: |
| 51 FakePaintedScrollbarLayer(const LayerSettings& settings, | 50 FakePaintedScrollbarLayer(FakeScrollbar* fake_scrollbar, |
| 52 FakeScrollbar* fake_scrollbar, | |
| 53 int scrolling_layer_id); | 51 int scrolling_layer_id); |
| 54 ~FakePaintedScrollbarLayer() override; | 52 ~FakePaintedScrollbarLayer() override; |
| 55 | 53 |
| 56 int update_count_; | 54 int update_count_; |
| 57 size_t push_properties_count_; | 55 size_t push_properties_count_; |
| 58 FakeScrollbar* fake_scrollbar_; | 56 FakeScrollbar* fake_scrollbar_; |
| 59 }; | 57 }; |
| 60 | 58 |
| 61 } // namespace cc | 59 } // namespace cc |
| 62 | 60 |
| 63 #endif // CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ | 61 #endif // CC_TEST_FAKE_PAINTED_SCROLLBAR_LAYER_H_ |
| OLD | NEW |