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 // Setting the src of an img to an empty string can crash the browser, so we | 5 // Setting the src of an img to an empty string can crash the browser, so we |
6 // use an empty 1x1 gif instead. | 6 // use an empty 1x1 gif instead. |
7 | 7 |
8 /** | 8 /** |
9 * FileManager constructor. | 9 * FileManager constructor. |
10 * | 10 * |
(...skipping 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3081 // checkbox and avoid the trouble. | 3081 // checkbox and avoid the trouble. |
3082 event.preventDefault(); | 3082 event.preventDefault(); |
3083 } | 3083 } |
3084 }; | 3084 }; |
3085 | 3085 |
3086 FileManager.prototype.onPinClick_ = function(checkbox, entry, event) { | 3086 FileManager.prototype.onPinClick_ = function(checkbox, entry, event) { |
3087 function callback(props) { | 3087 function callback(props) { |
3088 checkbox.checked = entry.gdata_.isPinned = props[0].isPinned; | 3088 checkbox.checked = entry.gdata_.isPinned = props[0].isPinned; |
3089 } | 3089 } |
3090 | 3090 |
3091 if (checkbox.checked) { | 3091 chrome.fileBrowserPrivate.pinGDataFile([entry.toURL()], |
3092 chrome.fileBrowserPrivate.pinGDataFile([entry.toURL()], callback); | 3092 !checkbox.checked, callback); |
3093 console.log('Pinning file ', entry.toURL()); | |
3094 } | |
3095 event.preventDefault(); | 3093 event.preventDefault(); |
3096 }; | 3094 }; |
3097 | 3095 |
3098 FileManager.prototype.selectDefaultPathInFilenameInput_ = function() { | 3096 FileManager.prototype.selectDefaultPathInFilenameInput_ = function() { |
3099 var input = this.filenameInput_; | 3097 var input = this.filenameInput_; |
3100 input.focus(); | 3098 input.focus(); |
3101 var selectionEnd = input.value.lastIndexOf('.'); | 3099 var selectionEnd = input.value.lastIndexOf('.'); |
3102 if (selectionEnd == -1) { | 3100 if (selectionEnd == -1) { |
3103 input.select(); | 3101 input.select(); |
3104 } else { | 3102 } else { |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4145 }); | 4143 }); |
4146 }, onError); | 4144 }, onError); |
4147 | 4145 |
4148 function onError(err) { | 4146 function onError(err) { |
4149 console.log('Error while checking free space: ' + err); | 4147 console.log('Error while checking free space: ' + err); |
4150 setTimeout(doCheck, 1000 * 60); | 4148 setTimeout(doCheck, 1000 * 60); |
4151 } | 4149 } |
4152 } | 4150 } |
4153 } | 4151 } |
4154 })(); | 4152 })(); |
OLD | NEW |