| 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() { |
| 11 | 11 |
| 12 /** | 12 /** |
| 13 * Dimensions for camera capture. | 13 * Dimensions for camera capture. |
| 14 * @const | 14 * @const |
| 15 */ | 15 */ |
| 16 var CAPTURE_SIZE = { | 16 var CAPTURE_SIZE = { |
| 17 height: 480, | 17 height: 480, |
| 18 width: 480 | 18 width: 480 |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 Polymer({ | 21 Polymer({ |
| 22 is: 'settings-camera', | 22 is: 'settings-camera', |
| 23 | 23 |
| 24 behaviors: [ | |
| 25 I18nBehavior, | |
| 26 ], | |
| 27 | |
| 28 properties: { | 24 properties: { |
| 29 /** | 25 /** |
| 30 * True if the user has selected the camera as the user image source. | 26 * True if the user has selected the camera as the user image source. |
| 31 * @type {boolean} | 27 * @type {boolean} |
| 32 */ | 28 */ |
| 33 cameraActive: { | 29 cameraActive: { |
| 34 type: Boolean, | 30 type: Boolean, |
| 35 observer: 'cameraActiveChanged_', | 31 observer: 'cameraActiveChanged_', |
| 36 value: false, | 32 value: false, |
| 37 }, | 33 }, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 canvas.height = CAPTURE_SIZE.height; | 200 canvas.height = CAPTURE_SIZE.height; |
| 205 var ctx = canvas.getContext('2d'); | 201 var ctx = canvas.getContext('2d'); |
| 206 ctx.translate(CAPTURE_SIZE.width, 0); | 202 ctx.translate(CAPTURE_SIZE.width, 0); |
| 207 ctx.scale(-1.0, 1.0); | 203 ctx.scale(-1.0, 1.0); |
| 208 ctx.drawImage(source, 0, 0); | 204 ctx.drawImage(source, 0, 0); |
| 209 return canvas.toDataURL('image/png'); | 205 return canvas.toDataURL('image/png'); |
| 210 }, | 206 }, |
| 211 }); | 207 }); |
| 212 | 208 |
| 213 })(); | 209 })(); |
| OLD | NEW |