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

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

Issue 10836100: Fixing race condition on banner showing code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3873 matching lines...) Expand 10 before | Expand all | Expand 10 after
3884 function createDiv(className, parent) { 3884 function createDiv(className, parent) {
3885 var div = parent.ownerDocument.createElement('div'); 3885 var div = parent.ownerDocument.createElement('div');
3886 div.className = className; 3886 div.className = className;
3887 parent.appendChild(div); 3887 parent.appendChild(div);
3888 return div; 3888 return div;
3889 } 3889 }
3890 3890
3891 var self = this; 3891 var self = this;
3892 3892
3893 function showBanner(type, messageId) { 3893 function showBanner(type, messageId) {
3894 if (!self.dialogContainer_.hasAttribute('gdrive-welcome-style')) {
3895 self.dialogContainer_.setAttribute('gdrive-welcome-style', true);
3896 var style = self.document_.createElement('link');
3897 style.rel = 'stylesheet';
3898 style.href = 'css/gdrive_welcome.css';
3899 self.document_.head.appendChild(style);
3900 style.onload = function() { showBanner(type, messageId) };
3901 return;
3902 }
3903
3904 self.showGDataWelcome_(type); 3894 self.showGDataWelcome_(type);
3905 3895
3906 var container = self.dialogDom_.querySelector('.gdrive-welcome.' + type); 3896 var container = self.dialogDom_.querySelector('.gdrive-welcome.' + type);
3907 if (container.firstElementChild) 3897 if (container.firstElementChild)
3908 return; // Do not re-create. 3898 return; // Do not re-create.
3909 3899
3910 var wrapper = createDiv('gdrive-welcome-wrapper', container); 3900 var wrapper = createDiv('gdrive-welcome-wrapper', container);
3911 createDiv('gdrive-welcome-icon', wrapper); 3901 createDiv('gdrive-welcome-icon', wrapper);
3912 3902
3913 var close = createDiv('cr-dialog-close', wrapper); 3903 var close = createDiv('cr-dialog-close', wrapper);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3956 3946
3957 var previousDirWasOnGData = false; 3947 var previousDirWasOnGData = false;
3958 3948
3959 function maybeShowBanner() { 3949 function maybeShowBanner() {
3960 if (!self.isOnGData()) { 3950 if (!self.isOnGData()) {
3961 self.showGDataWelcome_('none'); 3951 self.showGDataWelcome_('none');
3962 previousDirWasOnGData = false; 3952 previousDirWasOnGData = false;
3963 return; 3953 return;
3964 } 3954 }
3965 3955
3956 if (!self.dialogContainer_.hasAttribute('gdrive-welcome-style')) {
3957 self.dialogContainer_.setAttribute('gdrive-welcome-style', true);
3958 var style = self.document_.createElement('link');
3959 style.rel = 'stylesheet';
3960 style.href = 'css/gdrive_welcome.css';
3961 self.document_.head.appendChild(style);
3962 style.onload = function() { maybeShowBanner() };
3963 return;
3964 }
3965
3966 var counter = getHeaderCounter(); 3966 var counter = getHeaderCounter();
3967 3967
3968 if (self.directoryModel_.getFileList().length == 0 && counter == 0) { 3968 if (self.directoryModel_.getFileList().length == 0 && counter == 0) {
3969 // Only show the full page banner if the header banner was never shown. 3969 // Only show the full page banner if the header banner was never shown.
3970 // Do not increment the counter. 3970 // Do not increment the counter.
3971 // The timeout below is required because sometimes another 3971 // The timeout below is required because sometimes another
3972 // 'rescan-completed' event arrives shortly with non-empty file list. 3972 // 'rescan-completed' event arrives shortly with non-empty file list.
3973 setTimeout(function() { 3973 setTimeout(function() {
3974 if (self.isOnGData() && 3974 if (self.isOnGData() &&
3975 self.dialogContainer_.getAttribute('gdrive-welcome') != 'header') 3975 self.dialogContainer_.getAttribute('gdrive-welcome') != 'header')
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4052 } 4052 }
4053 4053
4054 var defaultActionSeparator = 4054 var defaultActionSeparator =
4055 this.dialogDom_.querySelector('#default-action-separator'); 4055 this.dialogDom_.querySelector('#default-action-separator');
4056 4056
4057 this.defaultActionMenuItem_.hidden = !taskItem; 4057 this.defaultActionMenuItem_.hidden = !taskItem;
4058 defaultActionSeparator.hidden = !taskItem; 4058 defaultActionSeparator.hidden = !taskItem;
4059 } 4059 }
4060 })(); 4060 })();
4061 4061
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698