Chromium Code Reviews| Index: chrome/browser/resources/settings/people_page/camera.js |
| diff --git a/chrome/browser/resources/settings/people_page/camera.js b/chrome/browser/resources/settings/people_page/camera.js |
| index b403884d4a638a823c3cefbffbf9fcf1b4e0ae86..c0289385d3077a10021cc2c75408a9f4e724f005 100644 |
| --- a/chrome/browser/resources/settings/people_page/camera.js |
| +++ b/chrome/browser/resources/settings/people_page/camera.js |
| @@ -66,6 +66,31 @@ Polymer({ |
| }, |
| /** |
| + * Performs photo capture from the live camera stream. 'phototaken' event |
| + * will be fired as soon as captured photo is available, with 'dataURL' |
| + * property containing the photo encoded as a data URL. |
| + * @private |
| + */ |
| + takePhoto: function() { |
|
tommycli
2016/02/19 23:59:01
Code is same, just made public and moved to public
|
| + if (!this.cameraOnline_) |
| + return; |
| + var canvas = /** @type {HTMLCanvasElement} */( |
| + document.createElement('canvas')); |
| + canvas.width = CAPTURE_SIZE.width; |
| + canvas.height = CAPTURE_SIZE.height; |
| + this.captureFrame_( |
| + this.$.cameraVideo, |
| + /** @type {!CanvasRenderingContext2D} */(canvas.getContext('2d'))); |
| + |
| + var photoDataUrl = this.isFlipped_ ? this.flipFrame_(canvas) : |
| + canvas.toDataURL('image/png'); |
| + this.fire('phototaken', {photoDataUrl: photoDataUrl}); |
| + |
| + announceAccessibleMessage( |
| + loadTimeData.getString('photoCaptureAccessibleText')); |
| + }, |
| + |
| + /** |
| * Observer for the cameraActive property. |
| * @private |
| */ |
| @@ -140,31 +165,6 @@ Polymer({ |
| }, |
| /** |
| - * Performs photo capture from the live camera stream. 'phototaken' event |
| - * will be fired as soon as captured photo is available, with 'dataURL' |
| - * property containing the photo encoded as a data URL. |
| - * @private |
| - */ |
| - onTapTakePhoto_: function() { |
| - if (!this.cameraOnline_) |
| - return; |
| - var canvas = /** @type {HTMLCanvasElement} */( |
| - document.createElement('canvas')); |
| - canvas.width = CAPTURE_SIZE.width; |
| - canvas.height = CAPTURE_SIZE.height; |
| - this.captureFrame_( |
| - this.$.cameraVideo, |
| - /** @type {!CanvasRenderingContext2D} */(canvas.getContext('2d'))); |
| - |
| - var photoDataUrl = this.isFlipped_ ? this.flipFrame_(canvas) : |
| - canvas.toDataURL('image/png'); |
| - this.fire('phototaken', {photoDataUrl: photoDataUrl}); |
| - |
| - announceAccessibleMessage( |
| - loadTimeData.getString('photoCaptureAccessibleText')); |
| - }, |
| - |
| - /** |
| * Captures a single still frame from a <video> element, placing it at the |
| * current drawing origin of a canvas context. |
| * @param {!HTMLVideoElement} video Video element to capture from. |