| 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 * Base class that Ribbon uses to display photos. | 6 * Base class that Ribbon uses to display photos. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 function RibbonClient() {} | 9 function RibbonClient() {} |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 Gallery.editorModes = [ | 61 Gallery.editorModes = [ |
| 62 new ImageEditor.Mode.InstantAutofix(), | 62 new ImageEditor.Mode.InstantAutofix(), |
| 63 new ImageEditor.Mode.Crop(), | 63 new ImageEditor.Mode.Crop(), |
| 64 new ImageEditor.Mode.Exposure(), | 64 new ImageEditor.Mode.Exposure(), |
| 65 new ImageEditor.Mode.OneClick('rotate_left', new Command.Rotate(-1)), | 65 new ImageEditor.Mode.OneClick('rotate_left', new Command.Rotate(-1)), |
| 66 new ImageEditor.Mode.OneClick('rotate_right', new Command.Rotate(1)) | 66 new ImageEditor.Mode.OneClick('rotate_right', new Command.Rotate(1)) |
| 67 ]; | 67 ]; |
| 68 | 68 |
| 69 Gallery.FADE_TIMEOUT = 3000; | 69 Gallery.FADE_TIMEOUT = 3000; |
| 70 Gallery.FIRST_FADE_TIMEOUT = 1000; | 70 Gallery.FIRST_FADE_TIMEOUT = 1000; |
| 71 Gallery.OVERWRITE_BUBBLE_MAX_TIMES = 5; |
| 71 | 72 |
| 72 Gallery.prototype.initDom_ = function() { | 73 Gallery.prototype.initDom_ = function() { |
| 73 var doc = this.document_; | 74 var doc = this.document_; |
| 74 | 75 |
| 75 doc.oncontextmenu = function(e) { e.preventDefault(); }; | 76 doc.oncontextmenu = function(e) { e.preventDefault(); }; |
| 76 | 77 |
| 77 // Clean up after the previous instance of Gallery. | 78 // Clean up after the previous instance of Gallery. |
| 78 this.container_.removeAttribute('editing'); | 79 this.container_.removeAttribute('editing'); |
| 79 this.container_.removeAttribute('tools'); | 80 this.container_.removeAttribute('tools'); |
| 80 | 81 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 this.filenameEdit_.blur(); | 124 this.filenameEdit_.blur(); |
| 124 if (this.isShowingVideo_()) | 125 if (this.isShowingVideo_()) |
| 125 this.mediaControls_.togglePlayStateWithFeedback(); | 126 this.mediaControls_.togglePlayStateWithFeedback(); |
| 126 }).bind(this)); | 127 }).bind(this)); |
| 127 this.container_.appendChild(this.imageContainer_); | 128 this.container_.appendChild(this.imageContainer_); |
| 128 | 129 |
| 129 this.toolbar_ = doc.createElement('div'); | 130 this.toolbar_ = doc.createElement('div'); |
| 130 this.toolbar_.className = 'toolbar tool dimmable'; | 131 this.toolbar_.className = 'toolbar tool dimmable'; |
| 131 this.container_.appendChild(this.toolbar_); | 132 this.container_.appendChild(this.toolbar_); |
| 132 | 133 |
| 133 var filenameSpacer = doc.createElement('div'); | 134 this.filenameSpacer_ = doc.createElement('div'); |
| 134 filenameSpacer.className = 'filename-spacer'; | 135 this.filenameSpacer_.className = 'filename-spacer'; |
| 135 this.toolbar_.appendChild(filenameSpacer); | 136 this.toolbar_.appendChild(this.filenameSpacer_); |
| 137 |
| 138 this.bubble_ = doc.createElement('div'); |
| 139 this.bubble_.className = 'bubble'; |
| 140 var bubbleContent = doc.createElement('div'); |
| 141 bubbleContent.innerHTML = this.displayStringFunction_('overwrite_bubble'); |
| 142 this.bubble_.appendChild(bubbleContent); |
| 143 var bubblePointer = doc.createElement('span'); |
| 144 bubblePointer.className = 'pointer bottom'; |
| 145 this.bubble_.appendChild(bubblePointer); |
| 146 var bubbleClose = doc.createElement('div'); |
| 147 bubbleClose.className = 'close-x'; |
| 148 bubbleClose.addEventListener('click', this.onCloseBubble_.bind(this)); |
| 149 this.bubble_.appendChild(bubbleClose); |
| 150 this.bubble_.setAttribute('hidden', 'hidden'); |
| 151 this.toolbar_.appendChild(this.bubble_); |
| 152 |
| 153 var nameBox = doc.createElement('div'); |
| 154 nameBox.className = 'namebox'; |
| 155 this.filenameSpacer_.appendChild(nameBox); |
| 136 | 156 |
| 137 this.filenameText_ = doc.createElement('div'); | 157 this.filenameText_ = doc.createElement('div'); |
| 138 this.filenameText_.className = 'name'; | |
| 139 this.filenameText_.addEventListener('click', | 158 this.filenameText_.addEventListener('click', |
| 140 this.onFilenameClick_.bind(this)); | 159 this.onFilenameClick_.bind(this)); |
| 141 filenameSpacer.appendChild(this.filenameText_); | 160 nameBox.appendChild(this.filenameText_); |
| 142 | 161 |
| 143 this.filenameEdit_ = doc.createElement('input'); | 162 this.filenameEdit_ = doc.createElement('input'); |
| 144 this.filenameEdit_.setAttribute('type', 'text'); | 163 this.filenameEdit_.setAttribute('type', 'text'); |
| 145 this.filenameEdit_.addEventListener('blur', | 164 this.filenameEdit_.addEventListener('blur', |
| 146 this.onFilenameEditBlur_.bind(this)); | 165 this.onFilenameEditBlur_.bind(this)); |
| 147 this.filenameEdit_.addEventListener('keydown', | 166 this.filenameEdit_.addEventListener('keydown', |
| 148 this.onFilenameEditKeydown_.bind(this)); | 167 this.onFilenameEditKeydown_.bind(this)); |
| 149 filenameSpacer.appendChild(this.filenameEdit_); | 168 nameBox.appendChild(this.filenameEdit_); |
| 150 | 169 |
| 151 var options = doc.createElement('div'); | 170 var options = doc.createElement('div'); |
| 152 options.className = 'options'; | 171 options.className = 'options'; |
| 153 filenameSpacer.appendChild(options); | 172 this.filenameSpacer_.appendChild(options); |
| 154 | 173 |
| 155 this.savedLabel_ = doc.createElement('div'); | 174 this.savedLabel_ = doc.createElement('div'); |
| 156 this.savedLabel_.className = 'saved'; | 175 this.savedLabel_.className = 'saved'; |
| 157 this.savedLabel_.textContent = this.displayStringFunction_('saved'); | 176 this.savedLabel_.textContent = this.displayStringFunction_('saved'); |
| 158 options.appendChild(this.savedLabel_); | 177 options.appendChild(this.savedLabel_); |
| 159 | 178 |
| 160 this.keepOriginal_ = doc.createElement('div'); | 179 var overwriteOriginalBox = doc.createElement('div'); |
| 161 this.keepOriginal_.className = 'keep-original'; | 180 overwriteOriginalBox.className = 'overwrite-original'; |
| 162 this.keepOriginal_.textContent = this.displayStringFunction_('keep_original'); | 181 options.appendChild(overwriteOriginalBox); |
| 163 this.keepOriginal_.addEventListener('click', | 182 |
| 164 this.onKeepOriginalClick_.bind(this)); | 183 this.overwriteOriginal_ = doc.createElement('input'); |
| 165 options.appendChild(this.keepOriginal_); | 184 this.overwriteOriginal_.type = 'checkbox'; |
| 185 this.overwriteOriginal_.id = 'overwrite-checkbox'; |
| 186 this.overwriteOriginal_.className = 'common white'; |
| 187 overwriteOriginalBox.appendChild(this.overwriteOriginal_); |
| 188 this.overwriteOriginal_.addEventListener('click', |
| 189 this.onOverwriteOriginalClick_.bind(this)); |
| 190 |
| 191 var overwriteLabel = doc.createElement('label'); |
| 192 overwriteLabel.textContent = |
| 193 this.displayStringFunction_('overwrite_original'); |
| 194 overwriteLabel.setAttribute('for', 'overwrite-checkbox'); |
| 195 overwriteOriginalBox.appendChild(overwriteLabel); |
| 166 | 196 |
| 167 this.buttonSpacer_ = doc.createElement('div'); | 197 this.buttonSpacer_ = doc.createElement('div'); |
| 168 this.buttonSpacer_.className = 'button-spacer'; | 198 this.buttonSpacer_.className = 'button-spacer'; |
| 169 this.toolbar_.appendChild(this.buttonSpacer_); | 199 this.toolbar_.appendChild(this.buttonSpacer_); |
| 170 | 200 |
| 171 this.ribbonSpacer_ = doc.createElement('div'); | 201 this.ribbonSpacer_ = doc.createElement('div'); |
| 172 this.ribbonSpacer_.className = 'ribbon-spacer'; | 202 this.ribbonSpacer_.className = 'ribbon-spacer'; |
| 173 this.toolbar_.appendChild(this.ribbonSpacer_); | 203 this.toolbar_.appendChild(this.ribbonSpacer_); |
| 174 | 204 |
| 175 this.mediaSpacer_ = doc.createElement('div'); | 205 this.mediaSpacer_ = doc.createElement('div'); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 this.displayStringFunction_); | 382 this.displayStringFunction_); |
| 353 } else { | 383 } else { |
| 354 this.shareMode_ = null; | 384 this.shareMode_ = null; |
| 355 } | 385 } |
| 356 }.bind(this)); | 386 }.bind(this)); |
| 357 }; | 387 }; |
| 358 | 388 |
| 359 Gallery.prototype.onImageContentChanged_ = function() { | 389 Gallery.prototype.onImageContentChanged_ = function() { |
| 360 this.imageChanges_++; | 390 this.imageChanges_++; |
| 361 if (this.imageChanges_ == 0) return; | 391 if (this.imageChanges_ == 0) return; |
| 362 if (this.imageChanges_ == 1) { // First edit | 392 |
| 363 this.keepOriginal_.setAttribute('visible', 'true'); | 393 if (this.imageChanges_ == 1) { |
| 364 this.savedLabel_.style.display = 'inline-block'; | 394 // First edit. |
| 395 this.filenameSpacer_.setAttribute('saved', 'saved'); |
| 396 this.filenameSpacer_.setAttribute('overwrite', 'overwrite'); |
| 397 |
| 398 var key = 'gallery-overwrite-original'; |
| 399 var overwrite = key in localStorage ? (localStorage[key] == "true") : true; |
| 400 this.overwriteOriginal_.checked = overwrite; |
| 401 this.applyOverwrite_(overwrite); |
| 402 |
| 403 key = 'gallery-overwrite-bubble'; |
| 404 var times = key in localStorage ? parseInt(localStorage[key], 10) : 0; |
| 405 if (times < Gallery.OVERWRITE_BUBBLE_MAX_TIMES) { |
| 406 this.bubble_.removeAttribute('hidden'); |
| 407 localStorage[key] = times + 1; |
| 408 } |
| 409 |
| 365 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('Edit')); | 410 ImageUtil.metrics.recordUserAction(ImageUtil.getMetricName('Edit')); |
| 366 } | 411 } |
| 412 |
| 367 var label = this.savedLabel_; | 413 var label = this.savedLabel_; |
| 368 setTimeout(function(){ label.setAttribute('highlighted', 'true'); }, 0); | 414 setTimeout(function(){ label.setAttribute('highlighted', 'true'); }, 0); |
| 369 setTimeout(function(){ label.removeAttribute('highlighted'); }, 300); | 415 setTimeout(function(){ label.removeAttribute('highlighted'); }, 300); |
| 370 }; | 416 }; |
| 371 | 417 |
| 372 Gallery.prototype.onKeepOriginalClick_ = function() { | 418 Gallery.prototype.applyOverwrite_ = function(overwrite) { |
| 373 this.keepOriginal_.removeAttribute('visible'); | 419 if (overwrite) { |
| 374 this.ribbon_.getSelectedItem().setCopyName(this.context_.saveDirEntry, | 420 this.ribbon_.getSelectedItem().setOriginalName(this.context_.saveDirEntry, |
| 375 this.updateFilename_.bind(this)); | 421 this.updateFilename_.bind(this)); |
| 422 } else { |
| 423 this.ribbon_.getSelectedItem().setCopyName(this.context_.saveDirEntry, |
| 424 this.updateFilename_.bind(this)); |
| 425 } |
| 426 }; |
| 427 |
| 428 Gallery.prototype.onOverwriteOriginalClick_ = function(event) { |
| 429 var overwrite = event.target.checked; |
| 430 localStorage['gallery-overwrite-original'] = overwrite; |
| 431 this.applyOverwrite_(overwrite); |
| 432 }; |
| 433 |
| 434 Gallery.prototype.onCloseBubble_ = function(event) { |
| 435 this.bubble_.setAttribute('hidden', 'hidden'); |
| 436 localStorage['gallery-overwrite-bubble'] = Gallery.OVERWRITE_BUBBLE_MAX_TIMES; |
| 376 }; | 437 }; |
| 377 | 438 |
| 378 Gallery.prototype.saveItem_ = function(item, callback, canvas, modified) { | 439 Gallery.prototype.saveItem_ = function(item, callback, canvas, modified) { |
| 379 if (modified) { | 440 if (modified) { |
| 380 item.save(this.context_.saveDirEntry, this.context_.metadataProvider, | 441 item.save(this.context_.saveDirEntry, this.context_.metadataProvider, |
| 381 canvas, callback); | 442 canvas, callback); |
| 382 } else { | 443 } else { |
| 383 if (callback) callback(); | 444 if (callback) callback(); |
| 384 } | 445 } |
| 385 }; | 446 }; |
| 386 | 447 |
| 387 Gallery.prototype.saveChanges_ = function(opt_callback) { | 448 Gallery.prototype.saveChanges_ = function(opt_callback) { |
| 388 this.imageChanges_ = 0; | 449 this.imageChanges_ = 0; |
| 450 this.bubble_.setAttribute('hidden', 'hidden'); |
| 389 if (this.isShowingVideo_()) { | 451 if (this.isShowingVideo_()) { |
| 390 // This call ensures that editor leaves the mode and closes respective UI | 452 // This call ensures that editor leaves the mode and closes respective UI |
| 391 // elements. Currently, the only mode for videos is sharing. | 453 // elements. Currently, the only mode for videos is sharing. |
| 392 this.editor_.leaveModeGently(); | 454 this.editor_.leaveModeGently(); |
| 393 if (opt_callback) opt_callback(); | 455 if (opt_callback) opt_callback(); |
| 394 return; | 456 return; |
| 395 } | 457 } |
| 396 this.editor_.requestImage( | 458 this.editor_.requestImage( |
| 397 this.saveItem_.bind(this, this.ribbon_.getSelectedItem(), opt_callback)); | 459 this.saveItem_.bind(this, this.ribbon_.getSelectedItem(), opt_callback)); |
| 398 }; | 460 }; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 416 } | 478 } |
| 417 | 479 |
| 418 this.context_.onNameChange(fullName); | 480 this.context_.onNameChange(fullName); |
| 419 | 481 |
| 420 var displayName = ImageUtil.getFileNameFromFullName(fullName); | 482 var displayName = ImageUtil.getFileNameFromFullName(fullName); |
| 421 this.filenameEdit_.value = displayName; | 483 this.filenameEdit_.value = displayName; |
| 422 this.filenameText_.textContent = displayName; | 484 this.filenameText_.textContent = displayName; |
| 423 }; | 485 }; |
| 424 | 486 |
| 425 Gallery.prototype.onFilenameClick_ = function() { | 487 Gallery.prototype.onFilenameClick_ = function() { |
| 426 ImageUtil.setAttribute(this.container_, 'renaming', true); | 488 ImageUtil.setAttribute(this.filenameSpacer_, 'renaming', true); |
| 427 setTimeout(this.filenameEdit_.select.bind(this.filenameEdit_), 0); | 489 setTimeout(this.filenameEdit_.select.bind(this.filenameEdit_), 0); |
| 428 this.cancelFading_(); | 490 this.cancelFading_(); |
| 429 }; | 491 }; |
| 430 | 492 |
| 431 Gallery.prototype.onFilenameEditBlur_ = function() { | 493 Gallery.prototype.onFilenameEditBlur_ = function() { |
| 432 if (this.filenameEdit_.value && this.filenameEdit_.value[0] == '.') { | 494 if (this.filenameEdit_.value && this.filenameEdit_.value[0] == '.') { |
| 433 this.editor_.getPrompt().show('file_hidden_name', 5000); | 495 this.editor_.getPrompt().show('file_hidden_name', 5000); |
| 434 this.filenameEdit_.focus(); | 496 this.filenameEdit_.focus(); |
| 435 return; | 497 return; |
| 436 } | 498 } |
| 437 | 499 |
| 438 if (this.filenameEdit_.value) { | 500 if (this.filenameEdit_.value) { |
| 439 this.renameItem_(this.ribbon_.getSelectedItem(), | 501 this.renameItem_(this.ribbon_.getSelectedItem(), |
| 440 this.filenameEdit_.value); | 502 this.filenameEdit_.value); |
| 441 } | 503 } |
| 442 | 504 |
| 443 ImageUtil.setAttribute(this.container_, 'renaming', false); | 505 ImageUtil.setAttribute(this.filenameSpacer_, 'renaming', false); |
| 444 this.initiateFading_(); | 506 this.initiateFading_(); |
| 445 }; | 507 }; |
| 446 | 508 |
| 447 Gallery.prototype.onFilenameEditKeydown_ = function() { | 509 Gallery.prototype.onFilenameEditKeydown_ = function() { |
| 448 switch (event.keyCode) { | 510 switch (event.keyCode) { |
| 449 case 27: // Escape | 511 case 27: // Escape |
| 450 this.updateFilename_(); | 512 this.updateFilename_(); |
| 451 this.filenameEdit_.blur(); | 513 this.filenameEdit_.blur(); |
| 452 break; | 514 break; |
| 453 | 515 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 475 | 537 |
| 476 function onSuccess(entry) { | 538 function onSuccess(entry) { |
| 477 item.setUrl(entry.toURL()); | 539 item.setUrl(entry.toURL()); |
| 478 self.updateFilename_(); | 540 self.updateFilename_(); |
| 479 } | 541 } |
| 480 | 542 |
| 481 function doRename() { | 543 function doRename() { |
| 482 if (self.imageChanges_ > 0) { | 544 if (self.imageChanges_ > 0) { |
| 483 // Use this name in the next save operation. | 545 // Use this name in the next save operation. |
| 484 item.setNameForSaving(newName); | 546 item.setNameForSaving(newName); |
| 485 self.keepOriginal_.removeAttribute('visible'); | 547 this.filenameSpacer_.removeAttribute('overwrite'); |
| 486 self.updateFilename_(); | 548 self.updateFilename_(); |
| 487 } else { | 549 } else { |
| 488 // Rename file in place. | 550 // Rename file in place. |
| 489 dir.getFile( | 551 dir.getFile( |
| 490 ImageUtil.getFullNameFromUrl(item.getUrl()), | 552 ImageUtil.getFullNameFromUrl(item.getUrl()), |
| 491 {create: false}, | 553 {create: false}, |
| 492 function(entry) { entry.moveTo(dir, newName, onSuccess, onError); }, | 554 function(entry) { entry.moveTo(dir, newName, onSuccess, onError); }, |
| 493 onError); | 555 onError); |
| 494 } | 556 } |
| 495 } | 557 } |
| 496 | 558 |
| 497 function onVictimFound(victim) { | 559 function onVictimFound(victim) { |
| 498 self.editor_.getPrompt().show('file_exists', 3000); | 560 self.editor_.getPrompt().show('file_exists', 3000); |
| 499 self.filenameEdit_.value = name; | 561 self.filenameEdit_.value = name; |
| 500 self.onFilenameClick_(); | 562 self.onFilenameClick_(); |
| 501 } | 563 } |
| 502 | 564 |
| 503 dir.getFile(newName, {create: false, exclusive: false}, | 565 dir.getFile(newName, {create: false, exclusive: false}, |
| 504 onVictimFound, doRename); | 566 onVictimFound, doRename); |
| 505 }; | 567 }; |
| 506 | 568 |
| 507 Gallery.prototype.isRenaming_ = function() { | 569 Gallery.prototype.isRenaming_ = function() { |
| 508 return this.container_.hasAttribute('renaming'); | 570 return this.filenameSpacer_.hasAttribute('renaming'); |
| 509 }; | 571 }; |
| 510 | 572 |
| 511 Gallery.getFileBrowserPrivate = function() { | 573 Gallery.getFileBrowserPrivate = function() { |
| 512 return chrome.fileBrowserPrivate || window.top.chrome.fileBrowserPrivate; | 574 return chrome.fileBrowserPrivate || window.top.chrome.fileBrowserPrivate; |
| 513 }; | 575 }; |
| 514 | 576 |
| 515 Gallery.prototype.toggleFullscreen_ = function() { | 577 Gallery.prototype.toggleFullscreen_ = function() { |
| 516 Gallery.getFileBrowserPrivate().toggleFullscreen(); | 578 Gallery.getFileBrowserPrivate().toggleFullscreen(); |
| 517 }; | 579 }; |
| 518 | 580 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 536 this.saveChanges_(this.close_.bind(this)); | 598 this.saveChanges_(this.close_.bind(this)); |
| 537 }; | 599 }; |
| 538 | 600 |
| 539 Gallery.prototype.prefetchImage = function(id, content, metadata) { | 601 Gallery.prototype.prefetchImage = function(id, content, metadata) { |
| 540 this.editor_.prefetchImage(id, content, metadata); | 602 this.editor_.prefetchImage(id, content, metadata); |
| 541 }; | 603 }; |
| 542 | 604 |
| 543 Gallery.prototype.openImage = function(id, content, metadata, slide, callback) { | 605 Gallery.prototype.openImage = function(id, content, metadata, slide, callback) { |
| 544 // The first change is load, we should not count it. | 606 // The first change is load, we should not count it. |
| 545 this.imageChanges_ = -1; | 607 this.imageChanges_ = -1; |
| 546 this.savedLabel_.style.display = 'none'; | 608 this.filenameSpacer_.removeAttribute('overwrite'); |
| 547 this.keepOriginal_.removeAttribute('visible'); | 609 this.filenameSpacer_.removeAttribute('saved'); |
| 548 | 610 |
| 549 var item = this.ribbon_.getSelectedItem(); | 611 var item = this.ribbon_.getSelectedItem(); |
| 550 this.updateFilename_(content); | 612 this.updateFilename_(content); |
| 551 | 613 |
| 552 this.showSpinner_(true); | 614 this.showSpinner_(true); |
| 553 | 615 |
| 554 var self = this; | 616 var self = this; |
| 555 function loadDone(loadType) { | 617 function loadDone(loadType) { |
| 556 var video = self.isShowingVideo_(); | 618 var video = self.isShowingVideo_(); |
| 557 ImageUtil.setAttribute(self.container_, 'video', video); | 619 ImageUtil.setAttribute(self.container_, 'video', video); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 this.editor_.getPrompt().showAt( | 729 this.editor_.getPrompt().showAt( |
| 668 'top', 'readonly_warning', 0, this.context_.readonlyDirName); | 730 'top', 'readonly_warning', 0, this.context_.readonlyDirName); |
| 669 } | 731 } |
| 670 this.cancelFading_(); | 732 this.cancelFading_(); |
| 671 } else { | 733 } else { |
| 672 this.editor_.getPrompt().hide(); | 734 this.editor_.getPrompt().hide(); |
| 673 if (!this.isShowingVideo_()) { | 735 if (!this.isShowingVideo_()) { |
| 674 var item = this.ribbon_.getSelectedItem(); | 736 var item = this.ribbon_.getSelectedItem(); |
| 675 this.editor_.requestImage(item.updateThumbnail.bind(item)); | 737 this.editor_.requestImage(item.updateThumbnail.bind(item)); |
| 676 } | 738 } |
| 677 this.savedLabel_.style.display = 'none'; | 739 this.filenameSpacer_.removeAttribute('saved'); |
| 678 this.keepOriginal_.removeAttribute('visible'); | 740 this.filenameSpacer_.removeAttribute('overwrite'); |
| 741 this.saveChanges_(); |
| 679 this.initiateFading_(); | 742 this.initiateFading_(); |
| 680 } | 743 } |
| 681 | 744 |
| 682 ImageUtil.setAttribute(this.editButton_, 'pressed', this.isEditing_()); | 745 ImageUtil.setAttribute(this.editButton_, 'pressed', this.isEditing_()); |
| 683 }; | 746 }; |
| 684 | 747 |
| 685 Gallery.prototype.isSharing_ = function(event) { | 748 Gallery.prototype.isSharing_ = function(event) { |
| 686 return this.shareMode_ && this.shareMode_ == this.editor_.getMode(); | 749 return this.shareMode_ && this.shareMode_ == this.editor_.getMode(); |
| 687 }; | 750 }; |
| 688 | 751 |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1253 tryNext(10); | 1316 tryNext(10); |
| 1254 }; | 1317 }; |
| 1255 | 1318 |
| 1256 Ribbon.Item.prototype.setCopyName = function(dirEntry, opt_callback) { | 1319 Ribbon.Item.prototype.setCopyName = function(dirEntry, opt_callback) { |
| 1257 this.createCopyName_(dirEntry, function(name) { | 1320 this.createCopyName_(dirEntry, function(name) { |
| 1258 this.nameForSaving_ = name; | 1321 this.nameForSaving_ = name; |
| 1259 if (opt_callback) opt_callback(); | 1322 if (opt_callback) opt_callback(); |
| 1260 }.bind(this)); | 1323 }.bind(this)); |
| 1261 }; | 1324 }; |
| 1262 | 1325 |
| 1326 Ribbon.Item.prototype.setOriginalName = function(dirEntry, opt_callback) { |
| 1327 this.nameForSaving_ = null; |
| 1328 if (opt_callback) opt_callback(); |
| 1329 }; |
| 1330 |
| 1263 Ribbon.Item.prototype.setNameForSaving = function(newName) { | 1331 Ribbon.Item.prototype.setNameForSaving = function(newName) { |
| 1264 this.nameForSaving_ = newName; | 1332 this.nameForSaving_ = newName; |
| 1265 }; | 1333 }; |
| 1266 | 1334 |
| 1267 // The url and metadata stored in the item are not valid while the modified | 1335 // The url and metadata stored in the item are not valid while the modified |
| 1268 // image is being saved. Use the results of the latest edit instead. | 1336 // image is being saved. Use the results of the latest edit instead. |
| 1269 | 1337 |
| 1270 Ribbon.Item.prototype.overrideContent = function(canvas, metadata) { | 1338 Ribbon.Item.prototype.overrideContent = function(canvas, metadata) { |
| 1271 this.canvas_ = canvas; | 1339 this.canvas_ = canvas; |
| 1272 this.backupMetadata_ = this.metadata_; | 1340 this.backupMetadata_ = this.metadata_; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 ShareMode.prototype.setUp = function() { | 1482 ShareMode.prototype.setUp = function() { |
| 1415 ImageEditor.Mode.prototype.setUp.apply(this, arguments); | 1483 ImageEditor.Mode.prototype.setUp.apply(this, arguments); |
| 1416 ImageUtil.setAttribute(this.menu_, 'hidden', false); | 1484 ImageUtil.setAttribute(this.menu_, 'hidden', false); |
| 1417 ImageUtil.setAttribute(this.button_, 'pressed', false); | 1485 ImageUtil.setAttribute(this.button_, 'pressed', false); |
| 1418 }; | 1486 }; |
| 1419 | 1487 |
| 1420 ShareMode.prototype.cleanUpUI = function() { | 1488 ShareMode.prototype.cleanUpUI = function() { |
| 1421 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); | 1489 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); |
| 1422 ImageUtil.setAttribute(this.menu_, 'hidden', true); | 1490 ImageUtil.setAttribute(this.menu_, 'hidden', true); |
| 1423 }; | 1491 }; |
| OLD | NEW |