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

Side by Side 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 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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @fileoverview The event page for Google Now for Chrome implementation. 8 * @fileoverview The event page for Google Now for Chrome implementation.
9 * The Google Now event page gets Google Now cards from the server and shows 9 * The Google Now event page gets Google Now cards from the server and shows
10 * them as Chrome notifications. 10 * them as Chrome notifications.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return true; 111 return true;
112 } 112 }
113 113
114 return false; 114 return false;
115 } 115 }
116 116
117 var tasks = buildTaskManager(areTasksConflicting); 117 var tasks = buildTaskManager(areTasksConflicting);
118 118
119 // Add error processing to API calls. 119 // Add error processing to API calls.
120 tasks.instrumentChromeApiFunction('location.onLocationUpdate.addListener', 0); 120 tasks.instrumentChromeApiFunction('location.onLocationUpdate.addListener', 0);
121 tasks.instrumentChromeApiFunction('metricsPrivate.getVariationParams', 1);
121 tasks.instrumentChromeApiFunction('notifications.create', 2); 122 tasks.instrumentChromeApiFunction('notifications.create', 2);
122 tasks.instrumentChromeApiFunction('notifications.update', 2); 123 tasks.instrumentChromeApiFunction('notifications.update', 2);
123 tasks.instrumentChromeApiFunction('notifications.getAll', 0); 124 tasks.instrumentChromeApiFunction('notifications.getAll', 0);
124 tasks.instrumentChromeApiFunction( 125 tasks.instrumentChromeApiFunction(
125 'notifications.onButtonClicked.addListener', 0); 126 'notifications.onButtonClicked.addListener', 0);
126 tasks.instrumentChromeApiFunction('notifications.onClicked.addListener', 0); 127 tasks.instrumentChromeApiFunction('notifications.onClicked.addListener', 0);
127 tasks.instrumentChromeApiFunction('notifications.onClosed.addListener', 0); 128 tasks.instrumentChromeApiFunction('notifications.onClosed.addListener', 0);
128 tasks.instrumentChromeApiFunction('omnibox.onInputEntered.addListener', 0); 129 tasks.instrumentChromeApiFunction('omnibox.onInputEntered.addListener', 0);
129 tasks.instrumentChromeApiFunction( 130 tasks.instrumentChromeApiFunction(
130 'preferencesPrivate.googleGeolocationAccessEnabled.get', 131 'preferencesPrivate.googleGeolocationAccessEnabled.get',
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 394 }
394 }); 395 });
395 } 396 }
396 397
397 /** 398 /**
398 * Starts getting location for a cards update. 399 * Starts getting location for a cards update.
399 */ 400 */
400 function requestLocation() { 401 function requestLocation() {
401 console.log('requestLocation'); 402 console.log('requestLocation');
402 recordEvent(GoogleNowEvent.LOCATION_REQUEST); 403 recordEvent(GoogleNowEvent.LOCATION_REQUEST);
403 // TODO(vadimt): Figure out location request options. Use experiments 404 // TODO(vadimt): Figure out location request options.
404 // framework to enable setting these parameters remotely. 405 chrome.metricsPrivate.getVariationParams('GoogleNow', function(params) {
405 chrome.location.watchLocation(LOCATION_WATCH_NAME, { 406 var minDistanceInMeters =
406 minDistanceInMeters: 100, 407 parseInt(params && params.minDistanceInMeters, 10) ||
407 minTimeInMilliseconds: 180000 // 3 minutes. 408 100;
409 var minTimeInMilliseconds =
410 parseInt(params && params.minTimeInMilliseconds, 10) ||
411 180000; // 3 minutes.
412
413 chrome.location.watchLocation(LOCATION_WATCH_NAME, {
414 minDistanceInMeters: minDistanceInMeters,
415 minTimeInMilliseconds: minTimeInMilliseconds
416 });
408 }); 417 });
409 } 418 }
410 419
411 /** 420 /**
412 * Stops getting the location. 421 * Stops getting the location.
413 */ 422 */
414 function stopRequestLocation() { 423 function stopRequestLocation() {
415 console.log('stopRequestLocation'); 424 console.log('stopRequestLocation');
416 chrome.location.clearWatch(LOCATION_WATCH_NAME); 425 chrome.location.clearWatch(LOCATION_WATCH_NAME);
417 } 426 }
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 934
926 instrumented.location.onLocationUpdate.addListener(function(position) { 935 instrumented.location.onLocationUpdate.addListener(function(position) {
927 recordEvent(GoogleNowEvent.LOCATION_UPDATE); 936 recordEvent(GoogleNowEvent.LOCATION_UPDATE);
928 updateNotificationsCards(position); 937 updateNotificationsCards(position);
929 }); 938 });
930 939
931 instrumented.omnibox.onInputEntered.addListener(function(text) { 940 instrumented.omnibox.onInputEntered.addListener(function(text) {
932 localStorage['server_url'] = NOTIFICATION_CARDS_URL = text; 941 localStorage['server_url'] = NOTIFICATION_CARDS_URL = text;
933 initialize(); 942 initialize();
934 }); 943 });
OLDNEW
« 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