| OLD | NEW |
| 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 Utility objects and functions for Google Now extension. | 8 * @fileoverview Utility objects and functions for Google Now extension. |
| 9 * Most important entities here: | 9 * Most important entities here: |
| 10 * (1) 'wrapper' is a module used to add error handling and other services to | 10 * (1) 'wrapper' is a module used to add error handling and other services to |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 console.log = function() { | 57 console.log = function() { |
| 58 var originalConsoleLog = console.log; | 58 var originalConsoleLog = console.log; |
| 59 return function() { | 59 return function() { |
| 60 if (isInDebugMode()) { | 60 if (isInDebugMode()) { |
| 61 originalConsoleLog.apply(console, arguments); | 61 originalConsoleLog.apply(console, arguments); |
| 62 } | 62 } |
| 63 }; | 63 }; |
| 64 }(); | 64 }(); |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * Location Card Storage. | 67 * Explanation Card Storage. |
| 68 */ | 68 */ |
| 69 if (localStorage['locationCardsShown'] === undefined) | 69 if (localStorage['explanatoryCardsShown'] === undefined) |
| 70 localStorage['locationCardsShown'] = 0; | 70 localStorage['explanatoryCardsShown'] = 0; |
| 71 |
| 72 /** |
| 73 * Location Card Count Cleanup. |
| 74 */ |
| 75 if (localStorage.locationCardsShown !== undefined) |
| 76 localStorage.removeItem('locationCardsShown'); |
| 71 | 77 |
| 72 /** | 78 /** |
| 73 * Builds an error object with a message that may be sent to the server. | 79 * Builds an error object with a message that may be sent to the server. |
| 74 * @param {string} message Error message. This message may be sent to the | 80 * @param {string} message Error message. This message may be sent to the |
| 75 * server. | 81 * server. |
| 76 * @return {Error} Error object. | 82 * @return {Error} Error object. |
| 77 */ | 83 */ |
| 78 function buildErrorWithMessageForServer(message) { | 84 function buildErrorWithMessageForServer(message) { |
| 79 var error = new Error(message); | 85 var error = new Error(message); |
| 80 error.canSendMessageToServer = true; | 86 error.canSendMessageToServer = true; |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 // One hour is just an arbitrary amount of time chosen. | 791 // One hour is just an arbitrary amount of time chosen. |
| 786 chrome.alarms.create(alarmName, {periodInMinutes: 60}); | 792 chrome.alarms.create(alarmName, {periodInMinutes: 60}); |
| 787 | 793 |
| 788 return { | 794 return { |
| 789 addListener: addListener, | 795 addListener: addListener, |
| 790 getAuthToken: getAuthToken, | 796 getAuthToken: getAuthToken, |
| 791 isSignedIn: isSignedIn, | 797 isSignedIn: isSignedIn, |
| 792 removeToken: removeToken | 798 removeToken: removeToken |
| 793 }; | 799 }; |
| 794 } | 800 } |
| OLD | NEW |