Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: chrome/browser/resources/options/chromeos/change_picture_options.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/chromeos/change_picture_options.js
diff --git a/chrome/browser/resources/options/chromeos/change_picture_options.js b/chrome/browser/resources/options/chromeos/change_picture_options.js
index 5034ca2099439978062c1fe311752619035e404a..fb3ddd2aa573b654a050df2f17ac35bba50f8fae 100644
--- a/chrome/browser/resources/options/chromeos/change_picture_options.js
+++ b/chrome/browser/resources/options/chromeos/change_picture_options.js
@@ -13,10 +13,7 @@ cr.define('options', function() {
* @type {Array<string>}
* @const
*/
- var ButtonImageUrls = [
- ButtonImages.TAKE_PHOTO,
- ButtonImages.CHOOSE_FILE
- ];
+ var ButtonImageUrls = [ButtonImages.TAKE_PHOTO, ButtonImages.CHOOSE_FILE];
/////////////////////////////////////////////////////////////////////////////
// ChangePictureOptions class:
@@ -27,9 +24,9 @@ cr.define('options', function() {
* @extends {cr.ui.pageManager.Page}
*/
function ChangePictureOptions() {
- Page.call(this, 'changePicture',
- loadTimeData.getString('changePicturePage'),
- 'change-picture-page');
+ Page.call(
+ this, 'changePicture', loadTimeData.getString('changePicturePage'),
+ 'change-picture-page');
}
cr.addSingletonGetter(ChangePictureOptions);
@@ -47,25 +44,29 @@ cr.define('options', function() {
// Preview image will track the selected item's URL.
var previewElement = $('user-image-preview');
- previewElement.oncontextmenu = function(e) { e.preventDefault(); };
+ previewElement.oncontextmenu = function(e) {
+ e.preventDefault();
+ };
imageGrid.previewElement = previewElement;
imageGrid.selectionType = 'default';
imageGrid.flipPhotoElement = $('flip-photo');
- imageGrid.addEventListener('select',
- this.handleImageSelected_.bind(this));
- imageGrid.addEventListener('activate',
- this.handleImageActivated_.bind(this));
- imageGrid.addEventListener('phototaken',
- this.handlePhotoTaken_.bind(this));
- imageGrid.addEventListener('photoupdated',
- this.handlePhotoTaken_.bind(this));
+ imageGrid.addEventListener(
+ 'select', this.handleImageSelected_.bind(this));
+ imageGrid.addEventListener(
+ 'activate', this.handleImageActivated_.bind(this));
+ imageGrid.addEventListener(
+ 'phototaken', this.handlePhotoTaken_.bind(this));
+ imageGrid.addEventListener(
+ 'photoupdated', this.handlePhotoTaken_.bind(this));
// Add the "Choose file" button.
- imageGrid.addItem(ButtonImages.CHOOSE_FILE,
- loadTimeData.getString('chooseFile'),
- this.handleChooseFile_.bind(this)).type = 'file';
+ imageGrid
+ .addItem(
+ ButtonImages.CHOOSE_FILE, loadTimeData.getString('chooseFile'),
+ this.handleChooseFile_.bind(this))
+ .type = 'file';
// Profile image data.
this.profileImage_ = imageGrid.addItem(
@@ -78,28 +79,28 @@ cr.define('options', function() {
loadTimeData.getString('takePhoto'),
loadTimeData.getString('photoFromCamera'));
- $('take-photo').addEventListener(
- 'click', this.handleTakePhoto_.bind(this));
- $('discard-photo').addEventListener(
- 'click', this.handleDiscardPhoto_.bind(this));
+ $('take-photo')
+ .addEventListener('click', this.handleTakePhoto_.bind(this));
+ $('discard-photo')
+ .addEventListener('click', this.handleDiscardPhoto_.bind(this));
// Toggle 'animation' class for the duration of WebKit transition.
- $('flip-photo').addEventListener(
- 'click', this.handleFlipPhoto_.bind(this));
- $('user-image-stream-crop').addEventListener(
- 'transitionend', function(e) {
+ $('flip-photo')
+ .addEventListener('click', this.handleFlipPhoto_.bind(this));
+ $('user-image-stream-crop')
+ .addEventListener('transitionend', function(e) {
previewElement.classList.remove('animation');
});
- $('user-image-preview-img').addEventListener(
- 'transitionend', function(e) {
+ $('user-image-preview-img')
+ .addEventListener('transitionend', function(e) {
previewElement.classList.remove('animation');
});
// Old user image data (if present).
this.oldImage_ = null;
- $('change-picture-overlay-confirm').addEventListener(
- 'click', this.closeOverlay_.bind(this));
+ $('change-picture-overlay-confirm')
+ .addEventListener('click', this.closeOverlay_.bind(this));
chrome.send('onChangePicturePageInitialized');
},
@@ -151,7 +152,8 @@ cr.define('options', function() {
imageGrid.previewElement.classList.add('animation');
imageGrid.flipPhoto = !imageGrid.flipPhoto;
var flipMessageId = imageGrid.flipPhoto ?
- 'photoFlippedAccessibleText' : 'photoFlippedBackAccessibleText';
+ 'photoFlippedAccessibleText' :
+ 'photoFlippedBackAccessibleText';
announceAccessibleMessage(loadTimeData.getString(flipMessageId));
},
@@ -204,23 +206,21 @@ cr.define('options', function() {
var url = imageGrid.selectedItemUrl;
// Flip button available only for camera picture.
- imageGrid.flipPhotoElement.hidden =
- imageGrid.selectionType != 'camera';
+ imageGrid.flipPhotoElement.hidden = imageGrid.selectionType != 'camera';
// Ignore selection change caused by program itself and selection of one
// of the action buttons.
- if (!imageGrid.inProgramSelection &&
- url != ButtonImages.TAKE_PHOTO && url != ButtonImages.CHOOSE_FILE) {
+ if (!imageGrid.inProgramSelection && url != ButtonImages.TAKE_PHOTO &&
+ url != ButtonImages.CHOOSE_FILE) {
chrome.send('selectImage', [url, imageGrid.selectionType]);
}
// Start/stop camera on (de)selection.
if (!imageGrid.inProgramSelection &&
imageGrid.selectionType != e.oldSelectionType) {
if (imageGrid.selectionType == 'camera') {
- imageGrid.startCamera(
- function() {
- // Start capture if camera is still the selected item.
- return imageGrid.selectedItem == imageGrid.cameraImage;
- });
+ imageGrid.startCamera(function() {
+ // Start capture if camera is still the selected item.
+ return imageGrid.selectedItem == imageGrid.cameraImage;
+ });
} else {
imageGrid.stopCamera();
}
@@ -324,8 +324,6 @@ cr.define('options', function() {
]);
// Export
- return {
- ChangePictureOptions: ChangePictureOptions
- };
+ return {ChangePictureOptions: ChangePictureOptions};
});

Powered by Google App Engine
This is Rietveld 408576698