OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
6 * @fileoverview Provides notification support for ChromeVox. | 6 * @fileoverview Provides notification support for ChromeVox. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('Notifications'); | 9 goog.provide('Notifications'); |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 } | 23 } |
24 | 24 |
25 UpdateNotification.prototype = { | 25 UpdateNotification.prototype = { |
26 /** @return {boolean} */ | 26 /** @return {boolean} */ |
27 shouldShow: function() { | 27 shouldShow: function() { |
28 return !localStorage['notifications_update_notification_shown'] && | 28 return !localStorage['notifications_update_notification_shown'] && |
29 chrome.runtime.getManifest().version >= '53' && | 29 chrome.runtime.getManifest().version >= '53' && |
30 cvox.ChromeVox.isChromeOS; | 30 cvox.ChromeVox.isChromeOS; |
31 }, | 31 }, |
32 | 32 |
33 /** Shows the notification. */ | 33 /** Shows the notification. */ |
34 show: function() { | 34 show: function() { |
35 if (!this.shouldShow()) | 35 if (!this.shouldShow()) |
36 return; | 36 return; |
37 chrome.notifications.create('update', this.data); | 37 chrome.notifications.create('update', this.data); |
38 chrome.notifications.onClicked.addListener(this.onClicked); | 38 chrome.notifications.onClicked.addListener(this.onClicked); |
39 chrome.notifications.onClosed.addListener(this.onClosed); | 39 chrome.notifications.onClosed.addListener(this.onClosed); |
40 }, | 40 }, |
41 | 41 |
42 /** | 42 /** |
43 * Handles the chrome.notifications event. | 43 * Handles the chrome.notifications event. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 }; | 93 }; |
94 | 94 |
95 /** | 95 /** |
96 * Resets to a clean state. Future events will trigger update notifications. | 96 * Resets to a clean state. Future events will trigger update notifications. |
97 */ | 97 */ |
98 Notifications.reset = function() { | 98 Notifications.reset = function() { |
99 if (Notifications.currentUpdate) | 99 if (Notifications.currentUpdate) |
100 Notifications.currentUpdate.removeAllListeners(); | 100 Notifications.currentUpdate.removeAllListeners(); |
101 delete localStorage['notifications_update_notification_shown']; | 101 delete localStorage['notifications_update_notification_shown']; |
102 }; | 102 }; |
OLD | NEW |