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

Unified Diff: chrome/browser/resources/google_now/background.js

Issue 22382006: Use experimentation framework parameters for location sensitivity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/google_now/background.js
diff --git a/chrome/browser/resources/google_now/background.js b/chrome/browser/resources/google_now/background.js
index d1d896aeac47868d8d22319306c5269cb8e01df8..893bfefc83e484e5ac8c5edb76ce8717f66d2fb6 100644
--- a/chrome/browser/resources/google_now/background.js
+++ b/chrome/browser/resources/google_now/background.js
@@ -118,6 +118,7 @@ var tasks = buildTaskManager(areTasksConflicting);
// Add error processing to API calls.
tasks.instrumentChromeApiFunction('location.onLocationUpdate.addListener', 0);
+tasks.instrumentChromeApiFunction('metricsPrivate.getVariationParams', 1);
tasks.instrumentChromeApiFunction('notifications.create', 2);
tasks.instrumentChromeApiFunction('notifications.update', 2);
tasks.instrumentChromeApiFunction('notifications.getAll', 0);
@@ -400,11 +401,19 @@ function requestNotificationCards(position, callback) {
function requestLocation() {
console.log('requestLocation');
recordEvent(GoogleNowEvent.LOCATION_REQUEST);
- // TODO(vadimt): Figure out location request options. Use experiments
- // framework to enable setting these parameters remotely.
- chrome.location.watchLocation(LOCATION_WATCH_NAME, {
- minDistanceInMeters: 100,
- minTimeInMilliseconds: 180000 // 3 minutes.
+ // TODO(vadimt): Figure out location request options.
+ chrome.metricsPrivate.getVariationParams('GoogleNow', function(params) {
+ var minDistanceInMeters =
+ parseInt(params && params.minDistanceInMeters, 10) ||
+ 100;
+ var minTimeInMilliseconds =
+ parseInt(params && params.minTimeInMilliseconds, 10) ||
+ 180000; // 3 minutes.
+
+ chrome.location.watchLocation(LOCATION_WATCH_NAME, {
+ minDistanceInMeters: minDistanceInMeters,
+ minTimeInMilliseconds: minTimeInMilliseconds
+ });
});
}
« no previous file with comments | « chrome/browser/extensions/extension_function_histogram_value.h ('k') | chrome/common/extensions/api/metrics_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698