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/input/top_controls_manager.h" | 5 #include "cc/input/top_controls_manager.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "cc/input/top_controls_manager_client.h" | 9 #include "cc/input/top_controls_manager_client.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 : host_impl_(&proxy_, &shared_bitmap_manager_), | 28 : host_impl_(&proxy_, &shared_bitmap_manager_), |
29 redraw_needed_(false), | 29 redraw_needed_(false), |
30 update_draw_properties_needed_(false), | 30 update_draw_properties_needed_(false), |
31 top_controls_top_offset_(0.f), | 31 top_controls_top_offset_(0.f), |
32 top_controls_show_threshold_(top_controls_show_threshold), | 32 top_controls_show_threshold_(top_controls_show_threshold), |
33 top_controls_hide_threshold_(top_controls_hide_threshold) { | 33 top_controls_hide_threshold_(top_controls_hide_threshold) { |
34 active_tree_ = LayerTreeImpl::create(&host_impl_); | 34 active_tree_ = LayerTreeImpl::create(&host_impl_); |
35 root_scroll_layer_ = LayerImpl::Create(active_tree_.get(), 1); | 35 root_scroll_layer_ = LayerImpl::Create(active_tree_.get(), 1); |
36 } | 36 } |
37 | 37 |
38 virtual ~MockTopControlsManagerClient() {} | 38 ~MockTopControlsManagerClient() override {} |
39 | 39 |
40 virtual void DidChangeTopControlsPosition() override { | 40 void DidChangeTopControlsPosition() override { |
41 redraw_needed_ = true; | 41 redraw_needed_ = true; |
42 update_draw_properties_needed_ = true; | 42 update_draw_properties_needed_ = true; |
43 } | 43 } |
44 | 44 |
45 virtual bool HaveRootScrollLayer() const override { | 45 bool HaveRootScrollLayer() const override { return true; } |
46 return true; | |
47 } | |
48 | 46 |
49 virtual void SetControlsTopOffset(float offset) override { | 47 void SetControlsTopOffset(float offset) override { |
50 top_controls_top_offset_ = offset; | 48 top_controls_top_offset_ = offset; |
51 } | 49 } |
52 | 50 |
53 virtual float ControlsTopOffset() const override { | 51 float ControlsTopOffset() const override { return top_controls_top_offset_; } |
54 return top_controls_top_offset_; | |
55 } | |
56 | 52 |
57 LayerImpl* rootScrollLayer() { | 53 LayerImpl* rootScrollLayer() { |
58 return root_scroll_layer_.get(); | 54 return root_scroll_layer_.get(); |
59 } | 55 } |
60 | 56 |
61 TopControlsManager* manager() { | 57 TopControlsManager* manager() { |
62 if (!manager_) { | 58 if (!manager_) { |
63 manager_ = TopControlsManager::Create(this, | 59 manager_ = TopControlsManager::Create(this, |
64 kTopControlsHeight, | 60 kTopControlsHeight, |
65 top_controls_show_threshold_, | 61 top_controls_show_threshold_, |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 manager->Animate(time); | 373 manager->Animate(time); |
378 EXPECT_GT(manager->ControlsTopOffset(), previous_offset); | 374 EXPECT_GT(manager->ControlsTopOffset(), previous_offset); |
379 previous_offset = manager->ControlsTopOffset(); | 375 previous_offset = manager->ControlsTopOffset(); |
380 } | 376 } |
381 EXPECT_FALSE(manager->animation()); | 377 EXPECT_FALSE(manager->animation()); |
382 EXPECT_EQ(0.f, manager->ControlsTopOffset()); | 378 EXPECT_EQ(0.f, manager->ControlsTopOffset()); |
383 } | 379 } |
384 | 380 |
385 } // namespace | 381 } // namespace |
386 } // namespace cc | 382 } // namespace cc |
OLD | NEW |