OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Called from the main frame when unloading. | 8 * Called from the main frame when unloading. |
9 * @param {boolean=} opt_exiting True if the app is exiting. | 9 * @param {boolean=} opt_exiting True if the app is exiting. |
10 */ | 10 */ |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 if (item) { | 767 if (item) { |
768 var oldEntry = item.getEntry(); | 768 var oldEntry = item.getEntry(); |
769 | 769 |
770 item.rename(this.filenameEdit_.value).then(function() { | 770 item.rename(this.filenameEdit_.value).then(function() { |
771 var event = new Event('content'); | 771 var event = new Event('content'); |
772 event.item = item; | 772 event.item = item; |
773 event.oldEntry = oldEntry; | 773 event.oldEntry = oldEntry; |
774 event.metadata = null; // Metadata unchanged. | 774 event.metadata = null; // Metadata unchanged. |
775 this.dataModel_.dispatchEvent(event); | 775 this.dataModel_.dispatchEvent(event); |
776 }.bind(this), function(error) { | 776 }.bind(this), function(error) { |
| 777 if (error === 'NOT_CHANGED') |
| 778 return; |
777 this.filenameEdit_.value = | 779 this.filenameEdit_.value = |
778 ImageUtil.getDisplayNameFromName(item.getEntry().name); | 780 ImageUtil.getDisplayNameFromName(item.getEntry().name); |
779 this.filenameEdit_.focus(); | 781 this.filenameEdit_.focus(); |
780 if (typeof error === 'string') | 782 if (typeof error === 'string') |
781 this.prompt_.showStringAt('center', error, 5000); | 783 this.prompt_.showStringAt('center', error, 5000); |
782 else | 784 else |
783 return Promise.reject(error); | 785 return Promise.reject(error); |
784 }.bind(this)).catch(function(error) { | 786 }.bind(this)).catch(function(error) { |
785 console.error(error.stack || error); | 787 console.error(error.stack || error); |
786 }); | 788 }); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 window.loadTimeData.data = backgroundComponents.stringData; | 966 window.loadTimeData.data = backgroundComponents.stringData; |
965 gallery = new Gallery(backgroundComponents.volumeManager); | 967 gallery = new Gallery(backgroundComponents.volumeManager); |
966 }; | 968 }; |
967 | 969 |
968 /** | 970 /** |
969 * Loads entries. | 971 * Loads entries. |
970 */ | 972 */ |
971 window.loadEntries = function(entries, selectedEntries) { | 973 window.loadEntries = function(entries, selectedEntries) { |
972 gallery.load(entries, selectedEntries); | 974 gallery.load(entries, selectedEntries); |
973 }; | 975 }; |
OLD | NEW |