| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 top_controls_show_height_( | 48 top_controls_show_height_( |
| 49 top_controls_height * top_controls_hide_threshold), | 49 top_controls_height * top_controls_hide_threshold), |
| 50 top_controls_hide_height_( | 50 top_controls_hide_height_( |
| 51 top_controls_height * (1.f - top_controls_show_threshold)) { | 51 top_controls_height * (1.f - top_controls_show_threshold)) { |
| 52 CHECK(client_); | 52 CHECK(client_); |
| 53 } | 53 } |
| 54 | 54 |
| 55 TopControlsManager::~TopControlsManager() { | 55 TopControlsManager::~TopControlsManager() { |
| 56 } | 56 } |
| 57 | 57 |
| 58 void TopControlsManager::UpdateTopControlsStatePreservingConstraints( |
| 59 TopControlsState current, |
| 60 bool animate) { |
| 61 UpdateTopControlsState(permitted_state_, current, animate); |
| 62 } |
| 63 |
| 58 void TopControlsManager::UpdateTopControlsState(TopControlsState constraints, | 64 void TopControlsManager::UpdateTopControlsState(TopControlsState constraints, |
| 59 TopControlsState current, | 65 TopControlsState current, |
| 60 bool animate) { | 66 bool animate) { |
| 61 DCHECK(!(constraints == SHOWN && current == HIDDEN)); | 67 DCHECK(!(constraints == SHOWN && current == HIDDEN)); |
| 62 DCHECK(!(constraints == HIDDEN && current == SHOWN)); | 68 DCHECK(!(constraints == HIDDEN && current == SHOWN)); |
| 63 | 69 |
| 64 permitted_state_ = constraints; | 70 permitted_state_ = constraints; |
| 65 | 71 |
| 66 // Don't do anything if it doesn't matter which state the controls are in. | 72 // Don't do anything if it doesn't matter which state the controls are in. |
| 67 if (constraints == BOTH && current == BOTH) | 73 if (constraints == BOTH && current == BOTH) |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 227 |
| 222 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || | 228 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || |
| 223 (animation_direction_ == HIDING_CONTROLS | 229 (animation_direction_ == HIDING_CONTROLS |
| 224 && new_offset <= -top_controls_height_)) { | 230 && new_offset <= -top_controls_height_)) { |
| 225 return true; | 231 return true; |
| 226 } | 232 } |
| 227 return false; | 233 return false; |
| 228 } | 234 } |
| 229 | 235 |
| 230 } // namespace cc | 236 } // namespace cc |
| OLD | NEW |