Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 60 |
| 61 if (!enable) { | 61 if (!enable) { |
| 62 ResetAnimations(); | 62 ResetAnimations(); |
| 63 if (controls_top_offset_ != 0) { | 63 if (controls_top_offset_ != 0) { |
| 64 SetupAnimation(SHOWING_CONTROLS); | 64 SetupAnimation(SHOWING_CONTROLS); |
| 65 client_->setNeedsRedraw(); | 65 client_->setNeedsRedraw(); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 void TopControlsManager::ShowTopControls(bool show) { | |
|
John Knottenbelt
2013/03/25 15:29:48
c++ indenting instead of java style
| |
| 71 if (show) { | |
| 72 if (controls_top_offset_ == 0) | |
| 73 return; | |
| 74 SetupAnimation(SHOWING_CONTROLS); | |
| 75 } else { | |
| 76 DCHECK(enable_hiding_); | |
| 77 if (controls_top_offset_ == -top_controls_height_) | |
| 78 return; | |
| 79 SetupAnimation(HIDING_CONTROLS); | |
| 80 } | |
| 81 } | |
| 82 | |
| 70 void TopControlsManager::ScrollBegin() { | 83 void TopControlsManager::ScrollBegin() { |
| 71 ResetAnimations(); | 84 ResetAnimations(); |
| 72 current_scroll_delta_ = 0.f; | 85 current_scroll_delta_ = 0.f; |
| 73 controls_scroll_begin_offset_ = controls_top_offset_; | 86 controls_scroll_begin_offset_ = controls_top_offset_; |
| 74 } | 87 } |
| 75 | 88 |
| 76 gfx::Vector2dF TopControlsManager::ScrollBy( | 89 gfx::Vector2dF TopControlsManager::ScrollBy( |
| 77 const gfx::Vector2dF pending_delta) { | 90 const gfx::Vector2dF pending_delta) { |
| 78 if (!enable_hiding_ && pending_delta.y() > 0) | 91 if (!enable_hiding_ && pending_delta.y() > 0) |
| 79 return pending_delta; | 92 return pending_delta; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 | 201 |
| 189 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || | 202 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || |
| 190 (animation_direction_ == HIDING_CONTROLS | 203 (animation_direction_ == HIDING_CONTROLS |
| 191 && new_offset <= -top_controls_height_)) { | 204 && new_offset <= -top_controls_height_)) { |
| 192 return true; | 205 return true; |
| 193 } | 206 } |
| 194 return false; | 207 return false; |
| 195 } | 208 } |
| 196 | 209 |
| 197 } // namespace cc | 210 } // namespace cc |
| OLD | NEW |