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

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: More notes 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 188545b8174a75fc37d7b0e80dece2b35936eb11..499c8afb181d4c85bbd44184d0a45a66057c8240 100644
--- a/chrome/browser/resources/google_now/background.js
+++ b/chrome/browser/resources/google_now/background.js
@@ -121,6 +121,7 @@ var tasks = buildTaskManager(areTasksConflicting);
// Add error processing to API calls.
tasks.instrumentApiFunction(chrome.location.onLocationUpdate, 'addListener', 0);
+tasks.instrumentApiFunction(chrome.metricsPrivate, 'getVariationParams', 1);
robliao 2013/08/09 22:01:54 Sync to the latest for updating to instrumentChrom
vadimt 2013/08/09 22:08:59 Will do before submittinng to CQ.
tasks.instrumentApiFunction(chrome.notifications, 'create', 2);
tasks.instrumentApiFunction(chrome.notifications, 'update', 2);
tasks.instrumentApiFunction(chrome.notifications, 'getAll', 0);
@@ -401,11 +402,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) ||
arv (Not doing code reviews) 2013/08/09 23:13:16 don't use parseInt without radix
vadimt 2013/08/10 01:16:07 Done.
+ 100;
+ var minTimeInMilliseconds =
+ parseInt(params && params.minTimeInMilliseconds) ||
+ 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