Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: cc/top_controls_manager.cc

Issue 11967015: Hide location bar on WebKit programmatic scroll. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove some plumbing. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/top_controls_manager.h" 5 #include "cc/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 top_controls_show_height_( 51 top_controls_show_height_(
52 top_controls_height * top_controls_hide_threshold), 52 top_controls_height * top_controls_hide_threshold),
53 top_controls_hide_height_( 53 top_controls_hide_height_(
54 top_controls_height * (1.f - top_controls_show_threshold)) { 54 top_controls_height * (1.f - top_controls_show_threshold)) {
55 CHECK(client_); 55 CHECK(client_);
56 } 56 }
57 57
58 TopControlsManager::~TopControlsManager() { 58 TopControlsManager::~TopControlsManager() {
59 } 59 }
60 60
61 void TopControlsManager::HideTopControls() {
62 if (controls_top_offset_ == -top_controls_height_)
63 return;
64
65 // We're in a user scroll.
jamesr 2013/03/04 21:44:03 This seems kind of iffy - who's responsible for de
John Knottenbelt 2013/03/05 16:41:48 The ultimate authority on whether the top controls
jamesr 2013/03/14 19:38:34 Yeah, I think this if should be removed.
66 if (in_scroll_gesture_)
67 return;
68
69 SetupAnimation(HIDING_CONTROLS);
70 }
71
61 void TopControlsManager::ScrollBegin() { 72 void TopControlsManager::ScrollBegin() {
62 ResetAnimations(); 73 ResetAnimations();
63 in_scroll_gesture_ = true; 74 in_scroll_gesture_ = true;
64 scroll_start_offset_ = RootScrollLayerTotalScrollY() + controls_top_offset_; 75 scroll_start_offset_ = RootScrollLayerTotalScrollY() + controls_top_offset_;
65 current_scroll_delta_ = 0.f; 76 current_scroll_delta_ = 0.f;
66 } 77 }
67 78
68 gfx::Vector2dF TopControlsManager::ScrollBy( 79 gfx::Vector2dF TopControlsManager::ScrollBy(
69 const gfx::Vector2dF pending_delta) { 80 const gfx::Vector2dF pending_delta) {
70 if (pending_delta.y() == 0 || !enable_hiding_) 81 if (pending_delta.y() == 0 || !enable_hiding_)
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 224
214 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || 225 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) ||
215 (animation_direction_ == HIDING_CONTROLS 226 (animation_direction_ == HIDING_CONTROLS
216 && new_offset <= -top_controls_height_)) { 227 && new_offset <= -top_controls_height_)) {
217 return true; 228 return true;
218 } 229 }
219 return false; 230 return false;
220 } 231 }
221 232
222 } // namespace cc 233 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698