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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
7 /** @const */ var Grid = cr.ui.Grid; | 7 /** @const */ var Grid = cr.ui.Grid; |
8 /** @const */ var GridItem = cr.ui.GridItem; | 8 /** @const */ var GridItem = cr.ui.GridItem; |
9 /** @const */ var GridSelectionController = cr.ui.GridSelectionController; | 9 /** @const */ var GridSelectionController = cr.ui.GridSelectionController; |
10 /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; | 10 /** @const */ var ListSingleSelectionModel = cr.ui.ListSingleSelectionModel; |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 canvas.height = CAPTURE_SIZE.height; | 529 canvas.height = CAPTURE_SIZE.height; |
530 var ctx = canvas.getContext('2d'); | 530 var ctx = canvas.getContext('2d'); |
531 ctx.translate(CAPTURE_SIZE.width, 0); | 531 ctx.translate(CAPTURE_SIZE.width, 0); |
532 ctx.scale(-1.0, 1.0); | 532 ctx.scale(-1.0, 1.0); |
533 ctx.drawImage(source, 0, 0); | 533 ctx.drawImage(source, 0, 0); |
534 return canvas.toDataURL('image/png'); | 534 return canvas.toDataURL('image/png'); |
535 }, | 535 }, |
536 | 536 |
537 /** | 537 /** |
538 * Adds new image to the user image grid. | 538 * Adds new image to the user image grid. |
539 * @param {string} src Image URL. | 539 * @param {string} url Image URL. |
540 * @param {string=} opt_title Image tooltip. | 540 * @param {string=} opt_title Image tooltip. |
541 * @param {function=} opt_clickHandler Image click handler. | 541 * @param {Function=} opt_clickHandler Image click handler. |
542 * @param {number=} opt_position If given, inserts new image into | 542 * @param {number=} opt_position If given, inserts new image into |
543 * that position (0-based) in image list. | 543 * that position (0-based) in image list. |
544 * @param {function=} opt_decorateFn Function called with the list element | 544 * @param {Function=} opt_decorateFn Function called with the list element |
545 * as argument to do any final decoration. | 545 * as argument to do any final decoration. |
546 * @return {!Object} Image data inserted into the data model. | 546 * @return {!Object} Image data inserted into the data model. |
547 */ | 547 */ |
548 // TODO(ivankr): this function needs some argument list refactoring. | 548 // TODO(ivankr): this function needs some argument list refactoring. |
549 addItem: function(url, opt_title, opt_clickHandler, opt_position, | 549 addItem: function(url, opt_title, opt_clickHandler, opt_position, |
550 opt_decorateFn) { | 550 opt_decorateFn) { |
551 var imageInfo = { | 551 var imageInfo = { |
552 url: url, | 552 url: url, |
553 title: opt_title, | 553 title: opt_title, |
554 clickHandler: opt_clickHandler, | 554 clickHandler: opt_clickHandler, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 UserImagesGrid.ButtonImages = { | 638 UserImagesGrid.ButtonImages = { |
639 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', | 639 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', |
640 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', | 640 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', |
641 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' | 641 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' |
642 }; | 642 }; |
643 | 643 |
644 return { | 644 return { |
645 UserImagesGrid: UserImagesGrid | 645 UserImagesGrid: UserImagesGrid |
646 }; | 646 }; |
647 }); | 647 }); |
OLD | NEW |