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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 this.toolbar_.appendChild(this.buttonSpacer_); | 127 this.toolbar_.appendChild(this.buttonSpacer_); |
128 | 128 |
129 this.ribbonSpacer_ = doc.createElement('div'); | 129 this.ribbonSpacer_ = doc.createElement('div'); |
130 this.ribbonSpacer_.className = 'ribbon-spacer'; | 130 this.ribbonSpacer_.className = 'ribbon-spacer'; |
131 this.toolbar_.appendChild(this.ribbonSpacer_); | 131 this.toolbar_.appendChild(this.ribbonSpacer_); |
132 | 132 |
133 this.mediaToolbar_ = doc.createElement('div'); | 133 this.mediaToolbar_ = doc.createElement('div'); |
134 this.mediaToolbar_.className = 'media-controls'; | 134 this.mediaToolbar_.className = 'media-controls'; |
135 this.toolbar_.appendChild(this.mediaToolbar_); | 135 this.toolbar_.appendChild(this.mediaToolbar_); |
136 | 136 |
137 this.mediaControls_ = | 137 this.mediaControls_ = new MediaControls(this.videoElement_, |
138 new MediaControls(this.videoElement_, this.mediaToolbar_); | 138 this.mediaToolbar_, this.toggleFullscreen_.bind(this)); |
139 | 139 |
140 this.arrowBox_ = this.document_.createElement('div'); | 140 this.arrowBox_ = this.document_.createElement('div'); |
141 this.arrowBox_.className = 'arrow-box'; | 141 this.arrowBox_.className = 'arrow-box'; |
142 this.container_.appendChild(this.arrowBox_); | 142 this.container_.appendChild(this.arrowBox_); |
143 | 143 |
144 this.arrowLeft_ = this.document_.createElement('div'); | 144 this.arrowLeft_ = this.document_.createElement('div'); |
145 this.arrowLeft_.className = 'arrow left tool dimmable'; | 145 this.arrowLeft_.className = 'arrow left tool dimmable'; |
146 this.arrowLeft_.appendChild(doc.createElement('div')); | 146 this.arrowLeft_.appendChild(doc.createElement('div')); |
147 this.arrowBox_.appendChild(this.arrowLeft_); | 147 this.arrowBox_.appendChild(this.arrowLeft_); |
148 | 148 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 dir.getFile(newName, {create: false, exclusive: false}, | 374 dir.getFile(newName, {create: false, exclusive: false}, |
375 onVictimFound, doRename); | 375 onVictimFound, doRename); |
376 }; | 376 }; |
377 | 377 |
378 Gallery.prototype.isRenaming_ = function() { | 378 Gallery.prototype.isRenaming_ = function() { |
379 return this.container_.hasAttribute('renaming'); | 379 return this.container_.hasAttribute('renaming'); |
380 }; | 380 }; |
381 | 381 |
| 382 Gallery.prototype.toggleFullscreen_ = function() { |
| 383 if (this.document_.webkitIsFullScreen) { |
| 384 this.document_.webkitCancelFullScreen(); |
| 385 } else { |
| 386 this.document_.body.webkitRequestFullScreen(); |
| 387 } |
| 388 }; |
| 389 |
382 Gallery.prototype.onClose_ = function() { | 390 Gallery.prototype.onClose_ = function() { |
| 391 if (this.document_.webkitIsFullScreen) { |
| 392 // Closing the Gallery iframe while in full screen will crash the tab. |
| 393 this.document_.addEventListener( |
| 394 'webkitfullscreenchange', this.onClose_.bind(this)); |
| 395 this.document_.webkitCancelFullScreen(); |
| 396 return; |
| 397 } |
383 // TODO: handle write errors gracefully (suggest retry or saving elsewhere). | 398 // TODO: handle write errors gracefully (suggest retry or saving elsewhere). |
384 this.saveChanges_(this.closeCallback_); | 399 this.saveChanges_(this.closeCallback_); |
385 }; | 400 }; |
386 | 401 |
387 Gallery.prototype.prefetchImage = function(id, content, metadata) { | 402 Gallery.prototype.prefetchImage = function(id, content, metadata) { |
388 if (Gallery.isVideoContent(content, metadata)) | 403 if (Gallery.isVideoContent(content, metadata)) |
389 return; | 404 return; |
390 | 405 |
391 this.editor_.prefetchImage(id, content, metadata); | 406 this.editor_.prefetchImage(id, content, metadata); |
392 }; | 407 }; |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 ShareMode.prototype.setUp = function() { | 1199 ShareMode.prototype.setUp = function() { |
1185 ImageEditor.Mode.prototype.setUp.apply(this, arguments); | 1200 ImageEditor.Mode.prototype.setUp.apply(this, arguments); |
1186 ImageUtil.setAttribute(this.menu_, 'hidden', false); | 1201 ImageUtil.setAttribute(this.menu_, 'hidden', false); |
1187 ImageUtil.setAttribute(this.button_, 'pressed', false); | 1202 ImageUtil.setAttribute(this.button_, 'pressed', false); |
1188 }; | 1203 }; |
1189 | 1204 |
1190 ShareMode.prototype.cleanUpUI = function() { | 1205 ShareMode.prototype.cleanUpUI = function() { |
1191 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); | 1206 ImageEditor.Mode.prototype.cleanUpUI.apply(this, arguments); |
1192 ImageUtil.setAttribute(this.menu_, 'hidden', true); | 1207 ImageUtil.setAttribute(this.menu_, 'hidden', true); |
1193 }; | 1208 }; |
OLD | NEW |