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

Side by Side Diff: content/browser/renderer_host/smooth_scroll_gesture_controller.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/browser/renderer_host/smooth_scroll_gesture_controller.h" 5 #include "content/browser/renderer_host/smooth_scroll_gesture_controller.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "content/common/view_messages.h" 9 #include "content/common/view_messages.h"
10 #include "content/port/browser/render_widget_host_view_port.h" 10 #include "content/port/browser/render_widget_host_view_port.h"
(...skipping 12 matching lines...) Expand all
23 SmoothScrollGestureController::SmoothScrollGestureController() 23 SmoothScrollGestureController::SmoothScrollGestureController()
24 : rwh_(NULL) { 24 : rwh_(NULL) {
25 } 25 }
26 26
27 SmoothScrollGestureController::~SmoothScrollGestureController() { 27 SmoothScrollGestureController::~SmoothScrollGestureController() {
28 } 28 }
29 29
30 void SmoothScrollGestureController::BeginSmoothScroll( 30 void SmoothScrollGestureController::BeginSmoothScroll(
31 RenderWidgetHostViewPort* view, 31 RenderWidgetHostViewPort* view,
32 const ViewHostMsg_BeginSmoothScroll_Params& params) { 32 const ViewHostMsg_BeginSmoothScroll_Params& params) {
33 if (pending_smooth_scroll_gesture_) 33 if (pending_smooth_scroll_gesture_.get())
34 return; 34 return;
35 35
36 rwh_ = view->GetRenderWidgetHost(); 36 rwh_ = view->GetRenderWidgetHost();
37 pending_smooth_scroll_gesture_ = view->CreateSmoothScrollGesture( 37 pending_smooth_scroll_gesture_ = view->CreateSmoothScrollGesture(
38 params.scroll_down, 38 params.scroll_down,
39 params.pixels_to_scroll, 39 params.pixels_to_scroll,
40 params.mouse_event_x, 40 params.mouse_event_x,
41 params.mouse_event_y); 41 params.mouse_event_y);
42 42
43 timer_.Start(FROM_HERE, GetSyntheticScrollMessageInterval(), this, 43 timer_.Start(FROM_HERE, GetSyntheticScrollMessageInterval(), this,
44 &SmoothScrollGestureController::OnTimer); 44 &SmoothScrollGestureController::OnTimer);
45 } 45 }
46 46
47 base::TimeDelta 47 base::TimeDelta
48 SmoothScrollGestureController::GetSyntheticScrollMessageInterval() const { 48 SmoothScrollGestureController::GetSyntheticScrollMessageInterval() const {
49 return base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs); 49 return base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs);
50 } 50 }
51 51
52 void SmoothScrollGestureController::OnTimer() { 52 void SmoothScrollGestureController::OnTimer() {
53 base::TimeTicks now = base::TimeTicks::Now(); 53 base::TimeTicks now = base::TimeTicks::Now();
54 if (!pending_smooth_scroll_gesture_->ForwardInputEvents(now, rwh_)) { 54 if (!pending_smooth_scroll_gesture_->ForwardInputEvents(now, rwh_)) {
55 timer_.Stop(); 55 timer_.Stop();
56 pending_smooth_scroll_gesture_ = NULL; 56 pending_smooth_scroll_gesture_ = NULL;
57 rwh_->Send(new ViewMsg_SmoothScrollCompleted(rwh_->GetRoutingID())); 57 rwh_->Send(new ViewMsg_SmoothScrollCompleted(rwh_->GetRoutingID()));
58 } 58 }
59 } 59 }
60 60
61 } // namespace content 61 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698