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

Side by Side Diff: ash/touch/touch_uma.cc

Issue 1417023002: Remove some implicit Point to PointF conversions, add helpers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-views: extrachange Created 5 years, 2 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
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 "ash/touch/touch_uma.h" 5 #include "ash/touch/touch_uma.h"
6 6
7 #include "ash/metrics/user_metrics_recorder.h" 7 #include "ash/metrics/user_metrics_recorder.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 const int bucket_size_x = std::max(1, 101 const int bucket_size_x = std::max(1,
102 bounds.width() / kBucketCountForLocation); 102 bounds.width() / kBucketCountForLocation);
103 const int bucket_size_y = std::max(1, 103 const int bucket_size_y = std::max(1,
104 bounds.height() / kBucketCountForLocation); 104 bounds.height() / kBucketCountForLocation);
105 105
106 gfx::Point position = event.root_location(); 106 gfx::Point position = event.root_location();
107 107
108 // Prefer raw event location (when available) over calibrated location. 108 // Prefer raw event location (when available) over calibrated location.
109 if (event.HasNativeEvent()) { 109 if (event.HasNativeEvent()) {
110 position = ui::EventLocationFromNative(event.native_event()); 110 position = ui::EventLocationFromNative(event.native_event());
111 position = gfx::ToFlooredPoint( 111 position = gfx::ScaleToFlooredPoint(
112 gfx::ScalePoint(position, 1. / target->layer()->device_scale_factor())); 112 position, 1.f / target->layer()->device_scale_factor());
113 } 113 }
114 114
115 position.set_x(std::min(bounds.width() - 1, std::max(0, position.x()))); 115 position.set_x(std::min(bounds.width() - 1, std::max(0, position.x())));
116 position.set_y(std::min(bounds.height() - 1, std::max(0, position.y()))); 116 position.set_y(std::min(bounds.height() - 1, std::max(0, position.y())));
117 117
118 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionX", 118 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionX",
119 position.x() / bucket_size_x, 119 position.x() / bucket_size_x,
120 0, kBucketCountForLocation, kBucketCountForLocation + 1); 120 0, kBucketCountForLocation, kBucketCountForLocation + 1);
121 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionY", 121 UMA_HISTOGRAM_CUSTOM_COUNTS("Ash.TouchPositionY",
122 position.y() / bucket_size_y, 122 position.y() / bucket_size_y,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 return GESTURE_OMNIBOX_SCROLL; 299 return GESTURE_OMNIBOX_SCROLL;
300 if (event.type() == ui::ET_GESTURE_PINCH_BEGIN) 300 if (event.type() == ui::ET_GESTURE_PINCH_BEGIN)
301 return GESTURE_OMNIBOX_PINCH; 301 return GESTURE_OMNIBOX_PINCH;
302 return GESTURE_UNKNOWN; 302 return GESTURE_UNKNOWN;
303 } 303 }
304 304
305 return GESTURE_UNKNOWN; 305 return GESTURE_UNKNOWN;
306 } 306 }
307 307
308 } // namespace ash 308 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/tabs/window_finder_x11.cc » ('j') | ui/gfx/geometry/point.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698