Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 36 this.onClicked.bind(this)); | 38 this.onClicked.bind(this)); |
| 37 chrome.notifications.onClosed.addListener( | 39 chrome.notifications.onClosed.addListener( |
| 38 this.onClosed.bind(this)); | 40 this.onClosed.bind(this)); |
| 39 }, | 41 }, |
| 40 | 42 |
| 41 /** | 43 /** |
| 42 * Handles the chrome.notifications event. | 44 * Handles the chrome.notifications event. |
| 43 * @param {string} notificationId | 45 * @param {string} notificationId |
| 44 */ | 46 */ |
| 45 onClicked: function(notificationId) { | 47 onClicked: function(notificationId) { |
| 46 var nextUpdatePage = {url: 'cvox2/background/next_update.html'}; | 48 (new PanelCommand(PanelCommandType.TUTORIAL)).send(); |
| 47 chrome.tabs.create(nextUpdatePage); | |
|
David Tseng
2016/06/29 20:59:43
Can you delete this file (if you're not planning o
dmazzoni
2016/06/29 22:51:35
Done.
| |
| 48 }, | 49 }, |
| 49 | 50 |
| 50 /** | 51 /** |
| 51 * Handles the chrome.notifications event. | 52 * Handles the chrome.notifications event. |
| 52 * @param {string} id | 53 * @param {string} id |
| 53 */ | 54 */ |
| 54 onClosed: function(id) { | 55 onClosed: function(id) { |
| 55 localStorage['notifications_update_notification_shown'] = true; | 56 localStorage['notifications_update_notification_shown'] = true; |
| 56 } | 57 } |
| 57 }; | 58 }; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 73 Notifications.onModeChange = function() { | 74 Notifications.onModeChange = function() { |
| 74 // Only run on background page. | 75 // Only run on background page. |
| 75 if (document.location.href.indexOf('background.html') == -1) | 76 if (document.location.href.indexOf('background.html') == -1) |
| 76 return; | 77 return; |
| 77 | 78 |
| 78 if (ChromeVoxState.instance.mode !== ChromeVoxMode.FORCE_NEXT) | 79 if (ChromeVoxState.instance.mode !== ChromeVoxMode.FORCE_NEXT) |
| 79 return; | 80 return; |
| 80 | 81 |
| 81 new UpdateNotification().show(); | 82 new UpdateNotification().show(); |
| 82 }; | 83 }; |
| OLD | NEW |