| 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 * This view displays options for importing data from a log file. | 6 * This view displays options for importing data from a log file. |
| 7 */ | 7 */ |
| 8 var ImportView = (function() { | 8 var ImportView = (function() { |
| 9 'use strict'; | 9 'use strict'; |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 * security reasons, which is why we allow the |files| array to be empty. | 75 * security reasons, which is why we allow the |files| array to be empty. |
| 76 */ | 76 */ |
| 77 onDrag: function(event) { | 77 onDrag: function(event) { |
| 78 // NOTE: Use Array.prototype.indexOf here is necessary while WebKit | 78 // NOTE: Use Array.prototype.indexOf here is necessary while WebKit |
| 79 // decides which type of data structure dataTransfer.types will be | 79 // decides which type of data structure dataTransfer.types will be |
| 80 // (currently between DOMStringList and Array). These have different APIs | 80 // (currently between DOMStringList and Array). These have different APIs |
| 81 // so assuming one type or the other was breaking things. See | 81 // so assuming one type or the other was breaking things. See |
| 82 // http://crbug.com/115433. TODO(dbeam): Remove when standardized more. | 82 // http://crbug.com/115433. TODO(dbeam): Remove when standardized more. |
| 83 var indexOf = Array.prototype.indexOf; | 83 var indexOf = Array.prototype.indexOf; |
| 84 return indexOf.call(event.dataTransfer.types, 'Files') == -1 || | 84 return indexOf.call(event.dataTransfer.types, 'Files') == -1 || |
| 85 event.dataTransfer.files.length > 1; | 85 event.dataTransfer.files.length > 1; |
| 86 }, | 86 }, |
| 87 | 87 |
| 88 /** | 88 /** |
| 89 * Called when something is dropped onto the drop target. If it's a single | 89 * Called when something is dropped onto the drop target. If it's a single |
| 90 * file, tries to load it as a log file. | 90 * file, tries to load it as a log file. |
| 91 */ | 91 */ |
| 92 onDrop: function(event) { | 92 onDrop: function(event) { |
| 93 var indexOf = Array.prototype.indexOf; | 93 var indexOf = Array.prototype.indexOf; |
| 94 if (indexOf.call(event.dataTransfer.types, 'Files') == -1 || | 94 if (indexOf.call(event.dataTransfer.types, 'Files') == -1 || |
| 95 event.dataTransfer.files.length != 1) { | 95 event.dataTransfer.files.length != 1) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 180 } |
| 181 }, | 181 }, |
| 182 | 182 |
| 183 enableLoadFileElement_: function(enabled) { | 183 enableLoadFileElement_: function(enabled) { |
| 184 this.loadFileElement_.disabled = !enabled; | 184 this.loadFileElement_.disabled = !enabled; |
| 185 }, | 185 }, |
| 186 }; | 186 }; |
| 187 | 187 |
| 188 return ImportView; | 188 return ImportView; |
| 189 })(); | 189 })(); |
| OLD | NEW |