Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/notifications.js

Issue 2104663003: Prepare ChromeVox for webstore release. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix key maps. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /** 11 /**
12 * ChromeVox update notification. 12 * ChromeVox update notification.
13 * @constructor 13 * @constructor
14 */ 14 */
15 function UpdateNotification() { 15 function UpdateNotification() {
16 this.data = {}; 16 this.data = {};
17 this.data.type = 'basic'; 17 this.data.type = 'basic';
18 this.data.iconUrl = '/images/chromevox-16.png'; 18 this.data.iconUrl = '/images/chromevox-16.png';
19 this.data.title = Msgs.getMsg('update_title'); 19 this.data.title = Msgs.getMsg('update_title');
20 this.data.message = Msgs.getMsg('update_message_next'); 20 this.data.message = Msgs.getMsg('update_message_next');
21 } 21 }
22 22
23 UpdateNotification.prototype = { 23 UpdateNotification.prototype = {
24 /** @return {boolean} */ 24 /** @return {boolean} */
25 shouldShow: function() { 25 shouldShow: function() {
26 return !localStorage['notifications_update_notification_shown'] && 26 return !localStorage['notifications_update_notification_shown'] &&
27 chrome.runtime.getManifest().version >= '53'; 27 chrome.runtime.getManifest().version >= '53' &&
28 cvox.ChromeVox.isChromeOS;
28 }, 29 },
29 30
30 /** Shows the notification. */ 31 /** Shows the notification. */
31 show: function() { 32 show: function() {
32 if (!this.shouldShow()) 33 if (!this.shouldShow())
33 return; 34 return;
34 chrome.notifications.create('update', this.data); 35 chrome.notifications.create('update', this.data);
35 chrome.notifications.onClicked.addListener( 36 chrome.notifications.onClicked.addListener(
36 this.onClicked.bind(this)); 37 this.onClicked.bind(this));
37 chrome.notifications.onClosed.addListener( 38 chrome.notifications.onClosed.addListener(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698