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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 10258011: [File Manager] Better Google Drive promo layout in Open/Save dialogs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
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 * FileManager constructor. 6 * FileManager constructor.
7 * 7 *
8 * FileManager objects encapsulate the functionality of the file selector 8 * FileManager objects encapsulate the functionality of the file selector
9 * dialogs, as well as the full screen file manager application (though the 9 * dialogs, as well as the full screen file manager application (though the
10 * latter is not yet implemented). 10 * latter is not yet implemented).
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 745
746 var retry = this.document_.createElement('button'); 746 var retry = this.document_.createElement('button');
747 retry.className = 'gdata retry'; 747 retry.className = 'gdata retry';
748 retry.textContent = str('GDATA_RETRY'); 748 retry.textContent = str('GDATA_RETRY');
749 retry.onclick = this.initGData_.bind(this, false /* retry */); 749 retry.onclick = this.initGData_.bind(this, false /* retry */);
750 this.unmountedPanel_.appendChild(retry); 750 this.unmountedPanel_.appendChild(retry);
751 751
752 var learnMore = this.document_.createElement('div'); 752 var learnMore = this.document_.createElement('div');
753 learnMore.className = 'gdata learn-more plain-link'; 753 learnMore.className = 'gdata learn-more plain-link';
754 learnMore.textContent = str('GDATA_LEARN_MORE'); 754 learnMore.textContent = str('GDATA_LEARN_MORE');
755 learnMore.addEventListener('click', function() { 755 learnMore.addEventListener('click',
756 chrome.tabs.create({url: GOOGLE_DRIVE_ERROR_HELP_URL}); 756 this.onExternalLinkClick_.bind(this, GOOGLE_DRIVE_ERROR_HELP_URL));
757 });
758 this.unmountedPanel_.appendChild(learnMore); 757 this.unmountedPanel_.appendChild(learnMore);
759 }; 758 };
760 759
761 FileManager.prototype.onDataModelSplice_ = function(event) { 760 FileManager.prototype.onDataModelSplice_ = function(event) {
762 var checkbox = this.document_.querySelector('#select-all-checkbox'); 761 var checkbox = this.document_.querySelector('#select-all-checkbox');
763 if (checkbox) 762 if (checkbox)
764 this.updateSelectAllCheckboxState_(checkbox); 763 this.updateSelectAllCheckboxState_(checkbox);
765 }; 764 };
766 765
767 FileManager.prototype.onDataModelPermuted_ = function(event) { 766 FileManager.prototype.onDataModelPermuted_ = function(event) {
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after
2413 label.appendChild(this.document_.createTextNode(task.title)); 2412 label.appendChild(this.document_.createTextNode(task.title));
2414 item.appendChild(label); 2413 item.appendChild(label);
2415 2414
2416 return item; 2415 return item;
2417 }; 2416 };
2418 2417
2419 FileManager.prototype.getExtensionId_ = function() { 2418 FileManager.prototype.getExtensionId_ = function() {
2420 return chrome.extension.getURL('').split('/')[2]; 2419 return chrome.extension.getURL('').split('/')[2];
2421 }; 2420 };
2422 2421
2423 FileManager.prototype.onDownloadsWarningClick_ = function(event) { 2422 FileManager.prototype.onExternalLinkClick_ = function(url) {
2424 chrome.tabs.create({url: DOWNLOADS_FAQ_URL}); 2423 chrome.tabs.create({url: url});
2425 if (this.dialogType_ != FileManager.DialogType.FULL_PAGE) { 2424 if (this.dialogType_ != FileManager.DialogType.FULL_PAGE) {
2426 this.onCancel_(); 2425 this.onCancel_();
2427 } 2426 }
2428 }; 2427 };
2429 2428
2430 FileManager.prototype.onTaskItemClicked_ = function(event) { 2429 FileManager.prototype.onTaskItemClicked_ = function(event) {
2431 this.dispatchFileTask_(event.item.task.taskId, this.selection.urls); 2430 this.dispatchFileTask_(event.item.task.taskId, this.selection.urls);
2432 }; 2431 };
2433 2432
2434 /** 2433 /**
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
3297 /** 3296 /**
3298 * Show or hide the "Low disk space" warning. 3297 * Show or hide the "Low disk space" warning.
3299 * @param {boolean} show True if the box need to be shown. 3298 * @param {boolean} show True if the box need to be shown.
3300 */ 3299 */
3301 FileManager.prototype.showLowDiskSpaceWarning_ = function(show) { 3300 FileManager.prototype.showLowDiskSpaceWarning_ = function(show) {
3302 var box = this.dialogDom_.querySelector('.downloads-warning'); 3301 var box = this.dialogDom_.querySelector('.downloads-warning');
3303 if (show) { 3302 if (show) {
3304 var html = util.htmlUnescape(str('DOWNLOADS_DIRECTORY_WARNING')); 3303 var html = util.htmlUnescape(str('DOWNLOADS_DIRECTORY_WARNING'));
3305 box.lastElementChild.innerHTML = html; 3304 box.lastElementChild.innerHTML = html;
3306 var link = box.querySelector('a'); 3305 var link = box.querySelector('a');
3307 link.addEventListener('click', this.onDownloadsWarningClick_.bind(this)); 3306 link.addEventListener('click',
3307 this.onExternalLinkClick_.bind(this, DOWNLOADS_FAQ_URL));
3308 } else { 3308 } else {
3309 box.lastElementChild.innerHTML = ''; 3309 box.lastElementChild.innerHTML = '';
3310 } 3310 }
3311 3311
3312 box.hidden = !show; 3312 box.hidden = !show;
3313 this.requestResize_(100); 3313 this.requestResize_(100);
3314 }; 3314 };
3315 3315
3316 /** 3316 /**
3317 * Update the location in the address bar. 3317 * Update the location in the address bar.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
3402 function(result) { 3402 function(result) {
3403 if (!result) { 3403 if (!result) {
3404 console.log('Failed to add file watch'); 3404 console.log('Failed to add file watch');
3405 this.watchedDirectoryUrl_ = null; 3405 this.watchedDirectoryUrl_ = null;
3406 } 3406 }
3407 }.bind(this)); 3407 }.bind(this));
3408 } 3408 }
3409 3409
3410 if (event.newDirEntry.unmounted) 3410 if (event.newDirEntry.unmounted)
3411 this.dialogContainer_.setAttribute('unmounted', true); 3411 this.dialogContainer_.setAttribute('unmounted', true);
3412 else 3412 else {
3413 this.dialogContainer_.removeAttribute('unmounted'); 3413 this.dialogContainer_.removeAttribute('unmounted');
3414 // Need to resize explicitly because the list container had display:none.
3415 this.onResize_();
3416 }
3414 3417
3415 if (this.isOnGData()) { 3418 if (this.isOnGData()) {
3416 this.dialogContainer_.setAttribute('gdata', true); 3419 this.dialogContainer_.setAttribute('gdata', true);
3417 if (event.newDirEntry.unmounted) { 3420 if (event.newDirEntry.unmounted) {
3418 this.initGData_(true /* directory changed */); 3421 this.initGData_(true /* directory changed */);
3419 } 3422 }
3420 } else { 3423 } else {
3421 this.dialogContainer_.removeAttribute('gdata'); 3424 this.dialogContainer_.removeAttribute('gdata');
3422 } 3425 }
3423 }; 3426 };
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
4311 title.textContent = 4314 title.textContent =
4312 strf('GDATA_WELCOME_TITLE', str('GDATA_PRODUCT_NAME')); 4315 strf('GDATA_WELCOME_TITLE', str('GDATA_PRODUCT_NAME'));
4313 4316
4314 var text = createDiv('gdrive-welcome-text', message); 4317 var text = createDiv('gdrive-welcome-text', message);
4315 text.innerHTML = strf(messageId, str('GDATA_PRODUCT_NAME')); 4318 text.innerHTML = strf(messageId, str('GDATA_PRODUCT_NAME'));
4316 4319
4317 var links = createDiv('gdrive-welcome-links', message); 4320 var links = createDiv('gdrive-welcome-links', message);
4318 4321
4319 var more = createDiv('gdrive-welcome-more plain-link', links); 4322 var more = createDiv('gdrive-welcome-more plain-link', links);
4320 more.textContent = str('GDATA_LEARN_MORE'); 4323 more.textContent = str('GDATA_LEARN_MORE');
4321 more.addEventListener('click', function() { 4324 more.addEventListener('click',
4322 chrome.tabs.create({url: GOOGLE_DRIVE_FAQ_URL}); 4325 self.onExternalLinkClick_.bind(self, GOOGLE_DRIVE_FAQ_URL));
4323 });
4324 4326
4325 var dismiss = createDiv('gdrive-welcome-dismiss plain-link', links); 4327 var dismiss = createDiv('gdrive-welcome-dismiss plain-link', links);
4326 dismiss.textContent = str('GDATA_WELCOME_DISMISS'); 4328 dismiss.textContent = str('GDATA_WELCOME_DISMISS');
4327 dismiss.addEventListener('click', closeBanner); 4329 dismiss.addEventListener('click', closeBanner);
4328 } 4330 }
4329 4331
4330 function maybeShowBanner() { 4332 function maybeShowBanner() {
4331 if (!self.isOnGData()) { 4333 if (!self.isOnGData()) {
4332 self.dialogContainer_.removeAttribute('gdrive-welcome'); 4334 self.dialogContainer_.removeAttribute('gdrive-welcome');
4333 return; 4335 return;
(...skipping 23 matching lines...) Expand all
4357 } 4359 }
4358 4360
4359 this.directoryModel_.addEventListener('scan-completed', maybeShowBanner); 4361 this.directoryModel_.addEventListener('scan-completed', maybeShowBanner);
4360 4362
4361 var style = this.document_.createElement('link'); 4363 var style = this.document_.createElement('link');
4362 style.rel = 'stylesheet'; 4364 style.rel = 'stylesheet';
4363 style.href = 'css/gdrive_welcome.css'; 4365 style.href = 'css/gdrive_welcome.css';
4364 this.document_.head.appendChild(style); 4366 this.document_.head.appendChild(style);
4365 }; 4367 };
4366 })(); 4368 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/harness.html ('k') | chrome/browser/resources/file_manager/js/mock_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698