OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * Responsible for showing banners in the file list. | 6 * Responsible for showing banners in the file list. |
7 * @param {DirectoryModel} directoryModel The model. | 7 * @param {DirectoryModel} directoryModel The model. |
8 * @param {VolumeManager} volumeManager The manager. | 8 * @param {VolumeManager} volumeManager The manager. |
9 * @param {DOMDocument} document HTML document. | 9 * @param {DOMDocument} document HTML document. |
10 * @constructor | 10 * @constructor |
11 */ | 11 */ |
12 function FileListBannerController(directoryModel, volumeManager, document) { | 12 function FileListBannerController(directoryModel, volumeManager, document) { |
13 this.directoryModel_ = directoryModel; | 13 this.directoryModel_ = directoryModel; |
14 this.volumeManager_ = volumeManager; | 14 this.volumeManager_ = volumeManager; |
15 this.document_ = document; | 15 this.document_ = document; |
16 this.driveEnabled_ = false; | 16 this.driveEnabled_ = false; |
17 | 17 |
18 var board = str('CHROMEOS_RELEASE_BOARD'); | 18 var board = str('CHROMEOS_RELEASE_BOARD'); |
19 if (board.match(/^(stumpy|lumpy)/i)) | 19 if (!board.match(/^x86-(mario|zgb|alex)/i)) |
20 this.checkPromoAvailable_(); | 20 this.checkPromoAvailable_(); |
21 else | 21 else |
22 this.newWelcome_ = false; | 22 this.newWelcome_ = false; |
23 | 23 |
24 var handler = this.checkSpaceAndShowBanner_.bind(this); | 24 var handler = this.checkSpaceAndShowBanner_.bind(this); |
25 this.directoryModel_.addEventListener('scan-completed', handler); | 25 this.directoryModel_.addEventListener('scan-completed', handler); |
26 this.directoryModel_.addEventListener('rescan-completed', handler); | 26 this.directoryModel_.addEventListener('rescan-completed', handler); |
27 this.directoryModel_.addEventListener('directory-changed', | 27 this.directoryModel_.addEventListener('directory-changed', |
28 this.onDirectoryChanged_.bind(this)); | 28 this.onDirectoryChanged_.bind(this)); |
29 | 29 |
(...skipping 12 matching lines...) Expand all Loading... |
42 * banner has shown. | 42 * banner has shown. |
43 */ | 43 */ |
44 var WELCOME_HEADER_COUNTER_KEY = 'gdataWelcomeHeaderCounter'; | 44 var WELCOME_HEADER_COUNTER_KEY = 'gdataWelcomeHeaderCounter'; |
45 | 45 |
46 /** | 46 /** |
47 * Maximum times Drive Welcome banner could have shown. | 47 * Maximum times Drive Welcome banner could have shown. |
48 */ | 48 */ |
49 var WELCOME_HEADER_COUNTER_LIMIT = 5; | 49 var WELCOME_HEADER_COUNTER_LIMIT = 5; |
50 | 50 |
51 /** | 51 /** |
52 * Location of the Chromebook information page. | |
53 */ | |
54 var CHROMEBOOK_INFO_URL = 'http://google.com/chromebook'; | |
55 | |
56 /** | |
57 * Location of the FAQ about Google Drive. | 52 * Location of the FAQ about Google Drive. |
58 */ | 53 */ |
59 var GOOGLE_DRIVE_FAQ_URL = | 54 var GOOGLE_DRIVE_FAQ_URL = |
60 'https://support.google.com/chromeos/?p=filemanager_drive'; | 55 'https://support.google.com/chromeos/?p=filemanager_drive'; |
61 | 56 |
62 /** | 57 /** |
63 * Location of the page to buy more storage for Google Drive. | 58 * Location of the page to buy more storage for Google Drive. |
64 */ | 59 */ |
65 var GOOGLE_DRIVE_BUY_STORAGE = | 60 var GOOGLE_DRIVE_BUY_STORAGE = |
66 'https://www.google.com/settings/storage'; | 61 'https://www.google.com/settings/storage'; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 text.innerHTML = str(messageId); | 108 text.innerHTML = str(messageId); |
114 | 109 |
115 var links = util.createChild(message, 'gdrive-welcome-links'); | 110 var links = util.createChild(message, 'gdrive-welcome-links'); |
116 | 111 |
117 var more; | 112 var more; |
118 if (this.newWelcome_) { | 113 if (this.newWelcome_) { |
119 title.textContent = str('GDATA_WELCOME_TITLE_ALTERNATIVE'); | 114 title.textContent = str('GDATA_WELCOME_TITLE_ALTERNATIVE'); |
120 more = util.createChild(links, | 115 more = util.createChild(links, |
121 'gdata-welcome-button gdata-welcome-start', 'a'); | 116 'gdata-welcome-button gdata-welcome-start', 'a'); |
122 more.textContent = str('GDATA_WELCOME_GET_STARTED'); | 117 more.textContent = str('GDATA_WELCOME_GET_STARTED'); |
123 more.href = CHROMEBOOK_INFO_URL; | 118 more.href = GOOGLE_DRIVE_REDEEM; |
124 } else { | 119 } else { |
125 title.textContent = str('GDATA_WELCOME_TITLE'); | 120 title.textContent = str('GDATA_WELCOME_TITLE'); |
126 more = util.createChild(links, 'plain-link', 'a'); | 121 more = util.createChild(links, 'plain-link', 'a'); |
127 more.textContent = str('GDATA_LEARN_MORE'); | 122 more.textContent = str('GDATA_LEARN_MORE'); |
128 more.href = GOOGLE_DRIVE_FAQ_URL; | 123 more.href = GOOGLE_DRIVE_FAQ_URL; |
129 } | 124 } |
130 | 125 |
131 var dismiss; | 126 var dismiss; |
132 if (this.newWelcome_) | 127 if (this.newWelcome_) |
133 dismiss = util.createChild(links, 'gdata-welcome-button', 'a'); | 128 dismiss = util.createChild(links, 'gdata-welcome-button', 'a'); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 * this.newWelcome_ get ready. | 524 * this.newWelcome_ get ready. |
530 * @private | 525 * @private |
531 */ | 526 */ |
532 FileListBannerController.prototype.preparePromo_ = function(completeCallback) { | 527 FileListBannerController.prototype.preparePromo_ = function(completeCallback) { |
533 if (this.newWelcome_ !== undefined) | 528 if (this.newWelcome_ !== undefined) |
534 completeCallback(); | 529 completeCallback(); |
535 else | 530 else |
536 (this.promoCallbacks_ = this.promoCallbacks_ || []).push(completeCallback); | 531 (this.promoCallbacks_ = this.promoCallbacks_ || []).push(completeCallback); |
537 }; | 532 }; |
538 | 533 |
OLD | NEW |