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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 304793003: use enum to specify deviceSource for fling animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed desired #include Created 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 bool WebContentsImpl::PreHandleGestureEvent( 1205 bool WebContentsImpl::PreHandleGestureEvent(
1206 const blink::WebGestureEvent& event) { 1206 const blink::WebGestureEvent& event) {
1207 return delegate_ && delegate_->PreHandleGestureEvent(this, event); 1207 return delegate_ && delegate_->PreHandleGestureEvent(this, event);
1208 } 1208 }
1209 1209
1210 bool WebContentsImpl::HandleGestureEvent( 1210 bool WebContentsImpl::HandleGestureEvent(
1211 const blink::WebGestureEvent& event) { 1211 const blink::WebGestureEvent& event) {
1212 // Some platforms (eg. Mac) send GesturePinch events for trackpad pinch-zoom. 1212 // Some platforms (eg. Mac) send GesturePinch events for trackpad pinch-zoom.
1213 // Use them to implement browser zoom, as for HandleWheelEvent above. 1213 // Use them to implement browser zoom, as for HandleWheelEvent above.
1214 if (event.type == blink::WebInputEvent::GesturePinchUpdate && 1214 if (event.type == blink::WebInputEvent::GesturePinchUpdate &&
1215 event.sourceDevice == blink::WebGestureEvent::Touchpad) { 1215 event.sourceDevice == blink::WebGestureDeviceTouchpad) {
1216 // The scale difference necessary to trigger a zoom action. Derived from 1216 // The scale difference necessary to trigger a zoom action. Derived from
1217 // experimentation to find a value that feels reasonable. 1217 // experimentation to find a value that feels reasonable.
1218 const float kZoomStepValue = 0.6f; 1218 const float kZoomStepValue = 0.6f;
1219 1219
1220 // Find the (absolute) thresholds on either side of the current zoom factor, 1220 // Find the (absolute) thresholds on either side of the current zoom factor,
1221 // then convert those to actual numbers to trigger a zoom in or out. 1221 // then convert those to actual numbers to trigger a zoom in or out.
1222 // This logic deliberately makes the range around the starting zoom value 1222 // This logic deliberately makes the range around the starting zoom value
1223 // for the gesture twice as large as the other ranges (i.e., the notches are 1223 // for the gesture twice as large as the other ranges (i.e., the notches are
1224 // at ..., -3*step, -2*step, -step, step, 2*step, 3*step, ... but not at 0) 1224 // at ..., -3*step, -2*step, -step, step, 2*step, 3*step, ... but not at 0)
1225 // so that it's easier to get back to your starting point than it is to 1225 // so that it's easier to get back to your starting point than it is to
(...skipping 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after
4071 4071
4072 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { 4072 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
4073 if (!delegate_) 4073 if (!delegate_)
4074 return; 4074 return;
4075 const gfx::Size new_size = GetPreferredSize(); 4075 const gfx::Size new_size = GetPreferredSize();
4076 if (new_size != old_size) 4076 if (new_size != old_size)
4077 delegate_->UpdatePreferredSize(this, new_size); 4077 delegate_->UpdatePreferredSize(this, new_size);
4078 } 4078 }
4079 4079
4080 } // namespace content 4080 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698