| 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 |
| 11 goog.require('PanelCommand'); |
| 12 |
| 11 /** | 13 /** |
| 12 * ChromeVox update notification. | 14 * ChromeVox update notification. |
| 13 * @constructor | 15 * @constructor |
| 14 */ | 16 */ |
| 15 function UpdateNotification() { | 17 function UpdateNotification() { |
| 16 this.data = {}; | 18 this.data = {}; |
| 17 this.data.type = 'basic'; | 19 this.data.type = 'basic'; |
| 18 this.data.iconUrl = '/images/chromevox-16.png'; | 20 this.data.iconUrl = '/images/chromevox-16.png'; |
| 19 this.data.title = Msgs.getMsg('update_title'); | 21 this.data.title = Msgs.getMsg('update_title'); |
| 20 this.data.message = Msgs.getMsg('update_message_next'); | 22 this.data.message = Msgs.getMsg('update_message_next'); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 this.onClicked.bind(this)); | 39 this.onClicked.bind(this)); |
| 38 chrome.notifications.onClosed.addListener( | 40 chrome.notifications.onClosed.addListener( |
| 39 this.onClosed.bind(this)); | 41 this.onClosed.bind(this)); |
| 40 }, | 42 }, |
| 41 | 43 |
| 42 /** | 44 /** |
| 43 * Handles the chrome.notifications event. | 45 * Handles the chrome.notifications event. |
| 44 * @param {string} notificationId | 46 * @param {string} notificationId |
| 45 */ | 47 */ |
| 46 onClicked: function(notificationId) { | 48 onClicked: function(notificationId) { |
| 47 var nextUpdatePage = {url: 'cvox2/background/next_update.html'}; | 49 (new PanelCommand(PanelCommandType.TUTORIAL)).send(); |
| 48 chrome.tabs.create(nextUpdatePage); | |
| 49 }, | 50 }, |
| 50 | 51 |
| 51 /** | 52 /** |
| 52 * Handles the chrome.notifications event. | 53 * Handles the chrome.notifications event. |
| 53 * @param {string} id | 54 * @param {string} id |
| 54 */ | 55 */ |
| 55 onClosed: function(id) { | 56 onClosed: function(id) { |
| 56 localStorage['notifications_update_notification_shown'] = true; | 57 localStorage['notifications_update_notification_shown'] = true; |
| 57 } | 58 } |
| 58 }; | 59 }; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 74 Notifications.onModeChange = function() { | 75 Notifications.onModeChange = function() { |
| 75 // Only run on background page. | 76 // Only run on background page. |
| 76 if (document.location.href.indexOf('background.html') == -1) | 77 if (document.location.href.indexOf('background.html') == -1) |
| 77 return; | 78 return; |
| 78 | 79 |
| 79 if (ChromeVoxState.instance.mode !== ChromeVoxMode.FORCE_NEXT) | 80 if (ChromeVoxState.instance.mode !== ChromeVoxMode.FORCE_NEXT) |
| 80 return; | 81 return; |
| 81 | 82 |
| 82 new UpdateNotification().show(); | 83 new UpdateNotification().show(); |
| 83 }; | 84 }; |
| OLD | NEW |