| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-camera' is the Polymer control used to take a picture from the | 7 * 'settings-camera' is the Polymer control used to take a picture from the |
| 8 * user webcam to use as a ChromeOS profile picture. | 8 * user webcam to use as a ChromeOS profile picture. |
| 9 */ | 9 */ |
| 10 (function() { | 10 (function() { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 this.cameraStartInProgress_ = false; | 134 this.cameraStartInProgress_ = false; |
| 135 }, | 135 }, |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Stops all video tracks associated with a MediaStream object. | 138 * Stops all video tracks associated with a MediaStream object. |
| 139 * @param {!MediaStream} stream | 139 * @param {!MediaStream} stream |
| 140 * @private | 140 * @private |
| 141 */ | 141 */ |
| 142 stopVideoTracks_: function(stream) { | 142 stopVideoTracks_: function(stream) { |
| 143 var tracks = stream.getVideoTracks(); | 143 var tracks = stream.getVideoTracks(); |
| 144 for (var t of tracks) | 144 for (var i = 0; i < tracks.length; i++) |
| 145 t.stop(); | 145 tracks[i].stop(); |
| 146 }, | 146 }, |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * Flip the live camera stream. | 149 * Flip the live camera stream. |
| 150 * @private | 150 * @private |
| 151 */ | 151 */ |
| 152 onTapFlipPhoto_: function() { | 152 onTapFlipPhoto_: function() { |
| 153 this.isFlipped_ = !this.isFlipped_; | 153 this.isFlipped_ = !this.isFlipped_; |
| 154 this.$.userImageStreamCrop.classList.toggle('flip-x', this.isFlipped_); | 154 this.$.userImageStreamCrop.classList.toggle('flip-x', this.isFlipped_); |
| 155 | 155 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 canvas.height = CAPTURE_SIZE.height; | 200 canvas.height = CAPTURE_SIZE.height; |
| 201 var ctx = canvas.getContext('2d'); | 201 var ctx = canvas.getContext('2d'); |
| 202 ctx.translate(CAPTURE_SIZE.width, 0); | 202 ctx.translate(CAPTURE_SIZE.width, 0); |
| 203 ctx.scale(-1.0, 1.0); | 203 ctx.scale(-1.0, 1.0); |
| 204 ctx.drawImage(source, 0, 0); | 204 ctx.drawImage(source, 0, 0); |
| 205 return canvas.toDataURL('image/png'); | 205 return canvas.toDataURL('image/png'); |
| 206 }, | 206 }, |
| 207 }); | 207 }); |
| 208 | 208 |
| 209 })(); | 209 })(); |
| OLD | NEW |