Chromium Code Reviews| 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 acc2aca1aa0d2fa8fc4bbc1cab4e567429d2f20e..b829b84afbaafd8e1db8313262327c0199d9a680 100644 |
| --- a/chrome/browser/resources/google_now/background.js |
| +++ b/chrome/browser/resources/google_now/background.js |
| @@ -227,7 +227,10 @@ var GoogleNowEvent = { |
| DELETED_SHOW_WELCOME_TOAST: 8, |
| STOPPED: 9, |
| DELETED_USER_SUPPRESSED: 10, |
| - EVENTS_TOTAL: 11 // EVENTS_TOTAL is not an event; all new events need to be |
| + SIGNED_OUT: 11, |
| + NOTIFICATION_DISABLED: 12, |
| + GOOGLE_NOW_DISABLED: 13, |
| + EVENTS_TOTAL: 14 // EVENTS_TOTAL is not an event; all new events need to be |
| // added before it. |
| }; |
| @@ -953,6 +956,24 @@ function setBackgroundEnable(backgroundEnable) { |
| } |
| /** |
| + * Report why this extension would not poll for cards. |
| + * @param {boolean} signedIn true if the user is signed in. |
| + * @param {boolean} notificationEnabled true if |
| + * Google Now for Chrome is allowed to show notifications. |
| + * @param {boolean} googleNowEnabled true if |
| + * the Google Now is enabled for the user. |
| + */ |
| +function reportNoCardsMetrics(signedIn, notificationEnabled, googleNowEnabled) { |
|
rgustafson
2014/03/24 23:18:26
recordEventsIfNoCards possibly?
recordEvent is th
robliao
2014/03/24 23:27:03
sgtm
On 2014/03/24 23:18:26, rgustafson wrote:
|
| + if (!signedIn) { |
| + recordEvent(GoogleNowEvent.SIGNED_OUT); |
| + } else if (!notificationEnabled) { |
| + recordEvent(GoogleNowEvent.NOTIFICATION_DISABLED); |
| + } else if (!googleNowEnabled) { |
| + recordEvent(GoogleNowEvent.GOOGLE_NOW_DISABLED); |
| + } |
| +} |
| + |
| +/** |
| * Does the actual work of deciding what Google Now should do |
| * based off of the current state of Chrome. |
| * @param {boolean} signedIn true if the user is signed in. |
| @@ -986,6 +1007,8 @@ function updateRunningState( |
| recordEvent(GoogleNowEvent.STOPPED); |
| } |
| + reportNoCardsMetrics(signedIn, notificationEnabled, googleNowEnabled); |
| + |
| console.log( |
| 'Requested Actions shouldSetBackground=' + shouldSetBackground + ' ' + |
| 'setShouldPollCards=' + shouldPollCards); |