| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 /** | 67 /** |
| 68 * Set after an update is shown. | 68 * Set after an update is shown. |
| 69 * @type {UpdateNotification} | 69 * @type {UpdateNotification} |
| 70 */ | 70 */ |
| 71 Notifications.currentUpdate; | 71 Notifications.currentUpdate; |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Runs notifications that should be shown for startup. | 74 * Runs notifications that should be shown for startup. |
| 75 */ | 75 */ |
| 76 Notifications.onStartup = function() { | 76 Notifications.onStartup = function() { |
| 77 return; | |
| 78 // Only run on background page. | 77 // Only run on background page. |
| 79 if (document.location.href.indexOf('background.html') == -1) | 78 if (document.location.href.indexOf('background.html') == -1) |
| 80 return; | 79 return; |
| 81 | 80 |
| 82 Notifications.reset(); | 81 Notifications.reset(); |
| 83 Notifications.currentUpdate = new UpdateNotification(); | 82 Notifications.currentUpdate = new UpdateNotification(); |
| 84 Notifications.currentUpdate.show(); | 83 Notifications.currentUpdate.show(); |
| 85 }; | 84 }; |
| 86 | 85 |
| 87 /** | 86 /** |
| 88 * Runs notifications that should be shown for mode changes. | 87 * Runs notifications that should be shown for mode changes. |
| 89 */ | 88 */ |
| 90 Notifications.onModeChange = function() { | 89 Notifications.onModeChange = function() { |
| 91 return; | |
| 92 // Only run on background page. | 90 // Only run on background page. |
| 93 if (document.location.href.indexOf('background.html') == -1) | 91 if (document.location.href.indexOf('background.html') == -1) |
| 94 return; | 92 return; |
| 95 | 93 |
| 96 if (ChromeVoxState.instance.mode !== ChromeVoxMode.FORCE_NEXT) | 94 if (ChromeVoxState.instance.mode !== ChromeVoxMode.FORCE_NEXT) |
| 97 return; | 95 return; |
| 98 | 96 |
| 99 Notifications.reset(); | 97 Notifications.reset(); |
| 100 Notifications.currentUpdate = new UpdateNotification(); | 98 Notifications.currentUpdate = new UpdateNotification(); |
| 101 Notifications.currentUpdate.show(); | 99 Notifications.currentUpdate.show(); |
| 102 }; | 100 }; |
| 103 | 101 |
| 104 /** | 102 /** |
| 105 * Resets to a clean state. Future events will trigger update notifications. | 103 * Resets to a clean state. Future events will trigger update notifications. |
| 106 */ | 104 */ |
| 107 Notifications.reset = function() { | 105 Notifications.reset = function() { |
| 108 if (Notifications.currentUpdate) | 106 if (Notifications.currentUpdate) |
| 109 Notifications.currentUpdate.removeAllListeners(); | 107 Notifications.currentUpdate.removeAllListeners(); |
| 110 delete localStorage['notifications_update_notification_shown']; | 108 delete localStorage['notifications_update_notification_shown']; |
| 111 }; | 109 }; |
| OLD | NEW |