| 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 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 */ | 53 */ |
| 54 var GOOGLE_DRIVE_FAQ_URL = | 54 var GOOGLE_DRIVE_FAQ_URL = |
| 55 'https://support.google.com/chromeos/?p=filemanager_drive'; | 55 'https://support.google.com/chromeos/?p=filemanager_drive'; |
| 56 | 56 |
| 57 /** | 57 /** |
| 58 * Location of the page to buy more storage for Google Drive. | 58 * Location of the page to buy more storage for Google Drive. |
| 59 */ | 59 */ |
| 60 var GOOGLE_DRIVE_BUY_STORAGE = | 60 var GOOGLE_DRIVE_BUY_STORAGE = |
| 61 'https://www.google.com/settings/storage'; | 61 'https://www.google.com/settings/storage'; |
| 62 | 62 |
| 63 var GOOGLE_DRIVE_REDEEM = 'https://drive.google.com/redeem'; | 63 var GOOGLE_DRIVE_REDEEM = |
| 64 'http://www.google.com/intl/en/chrome/devices/goodies.html'; |
| 64 | 65 |
| 65 /** | 66 /** |
| 66 * Location of the FAQ about the downloads directory. | 67 * Location of the FAQ about the downloads directory. |
| 67 */ | 68 */ |
| 68 var DOWNLOADS_FAQ_URL = | 69 var DOWNLOADS_FAQ_URL = |
| 69 'http://support.google.com/chromeos/bin/answer.py?answer=1061547'; | 70 'http://support.google.com/chromeos/bin/answer.py?answer=1061547'; |
| 70 | 71 |
| 71 /** | 72 /** |
| 72 * Location of the help page about connecting to Google Drive. | 73 * Location of the help page about connecting to Google Drive. |
| 73 */ | 74 */ |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 } else { | 504 } else { |
| 504 node.removeAttribute('gdata'); | 505 node.removeAttribute('gdata'); |
| 505 } | 506 } |
| 506 }; | 507 }; |
| 507 | 508 |
| 508 /** | 509 /** |
| 509 * Detects what type of promo should be shown. | 510 * Detects what type of promo should be shown. |
| 510 * @private | 511 * @private |
| 511 */ | 512 */ |
| 512 FileListBannerController.prototype.checkPromoAvailable_ = function() { | 513 FileListBannerController.prototype.checkPromoAvailable_ = function() { |
| 513 var r = new XMLHttpRequest(); | 514 this.newWelcome_ = true; |
| 514 r.open('HEAD', GOOGLE_DRIVE_REDEEM, true); | 515 if (this.promoCallbacks_) { |
| 515 r.onreadystatechange = function() { | 516 for (var i = 0; i < this.promoCallbacks_.length; i++) |
| 516 if (r.readyState != 4) | 517 this.promoCallbacks_[i](); |
| 517 return; | 518 this.promoCallbacks_ = undefined; |
| 518 this.newWelcome_ = r.status == 200; | 519 } |
| 519 if (this.promoCallbacks_) { | |
| 520 for (var i = 0; i < this.promoCallbacks_.length; i++) | |
| 521 this.promoCallbacks_[i](); | |
| 522 this.promoCallbacks_ = undefined; | |
| 523 } | |
| 524 }.bind(this); | |
| 525 r.send(); | |
| 526 }; | 520 }; |
| 527 | 521 |
| 528 /** | 522 /** |
| 529 * @param {Function} completeCallback To be called (may be directly) when | 523 * @param {Function} completeCallback To be called (may be directly) when |
| 530 * this.newWelcome_ get ready. | 524 * this.newWelcome_ get ready. |
| 531 * @private | 525 * @private |
| 532 */ | 526 */ |
| 533 FileListBannerController.prototype.preparePromo_ = function(completeCallback) { | 527 FileListBannerController.prototype.preparePromo_ = function(completeCallback) { |
| 534 if (this.newWelcome_ !== undefined) | 528 if (this.newWelcome_ !== undefined) |
| 535 completeCallback(); | 529 completeCallback(); |
| 536 else | 530 else |
| 537 (this.promoCallbacks_ = this.promoCallbacks_ || []).push(completeCallback); | 531 (this.promoCallbacks_ = this.promoCallbacks_ || []).push(completeCallback); |
| 538 }; | 532 }; |
| 539 | 533 |
| OLD | NEW |