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

Side by Side Diff: chrome/browser/resources/chromeos/login/oobe_screen_user_image.js

Issue 10969032: [cros] Avatar picker: various fixes for web camera problems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/user_images_grid.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 5 /**
6 * @fileoverview Oobe user image screen implementation. 6 * @fileoverview Oobe user image screen implementation.
7 */ 7 */
8 8
9 cr.define('oobe', function() { 9 cr.define('oobe', function() {
10 var UserImagesGrid = options.UserImagesGrid; 10 var UserImagesGrid = options.UserImagesGrid;
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 this.handleTakePhoto_(); 468 this.handleTakePhoto_();
469 break; 469 break;
470 default: 470 default:
471 this.acceptImage_(); 471 this.acceptImage_();
472 break; 472 break;
473 } 473 }
474 }, 474 },
475 475
476 /** 476 /**
477 * Handles selection change. 477 * Handles selection change.
478 * @param {cr.Event} e Selection change event.
478 * @private 479 * @private
479 */ 480 */
480 handleSelect_: function() { 481 handleSelect_: function(e) {
481 var imageGrid = $('user-image-grid'); 482 var imageGrid = $('user-image-grid');
482 if (imageGrid.selectionType == 'camera' && imageGrid.cameraLive) { 483 if (imageGrid.selectionType == 'camera' && imageGrid.cameraLive) {
483 // No current image selected. 484 // No current image selected.
484 $('ok-button').disabled = true; 485 $('ok-button').disabled = true;
485 } else { 486 } else {
486 $('ok-button').disabled = false; 487 $('ok-button').disabled = false;
487 chrome.send('selectImage', [imageGrid.selectedItemUrl]); 488 chrome.send('selectImage', [imageGrid.selectedItemUrl]);
488 } 489 }
489 // Start/stop camera on (de)selection. 490 // Start/stop camera on (de)selection.
490 if (!imageGrid.inProgramSelection) { 491 if (!imageGrid.inProgramSelection &&
491 if (imageGrid.selectionType == 'camera' && !imageGrid.cameraOnline) { 492 imageGrid.selectionType != e.oldSelectionType) {
493 if (imageGrid.selectionType == 'camera') {
492 // Programmatic selection of camera item is done in 494 // Programmatic selection of camera item is done in
493 // checkCameraPresence callback where streaming is started by itself. 495 // checkCameraPresence callback where streaming is started by itself.
494 imageGrid.checkCameraPresence( 496 imageGrid.checkCameraPresence(
495 function() { // When present. 497 function() { // When present.
496 // Start capture if camera is still the selected item. 498 // Start capture if camera is still the selected item.
497 return imageGrid.selectedItem == imageGrid.cameraImage; 499 return imageGrid.selectedItem == imageGrid.cameraImage;
498 }, 500 },
499 function() { // When absent. 501 function() { // When absent.
500 return true; // Check again after some time. 502 return true; // Check again after some time.
501 }); 503 });
502 } else if (imageGrid.selectionType != 'camera' && 504 } else {
503 imageGrid.cameraOnline) {
504 imageGrid.stopCamera(); 505 imageGrid.stopCamera();
505 } 506 }
506 } 507 }
507 this.updateCaption_(); 508 this.updateCaption_();
508 // Update image attribution text. 509 // Update image attribution text.
509 var image = imageGrid.selectedItem; 510 var image = imageGrid.selectedItem;
510 $('user-image-author-name').textContent = image.author; 511 $('user-image-author-name').textContent = image.author;
511 $('user-image-author-website').textContent = image.website; 512 $('user-image-author-website').textContent = image.website;
512 $('user-image-author-website').href = image.website; 513 $('user-image-author-website').href = image.website;
513 $('user-image-attribution').style.visibility = 514 $('user-image-attribution').style.visibility =
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 ].forEach(function(name) { 644 ].forEach(function(name) {
644 UserImageScreen[name] = function(value) { 645 UserImageScreen[name] = function(value) {
645 $('user-image')[name + '_'](value); 646 $('user-image')[name + '_'](value);
646 }; 647 };
647 }); 648 });
648 649
649 return { 650 return {
650 UserImageScreen: UserImageScreen 651 UserImageScreen: UserImageScreen
651 }; 652 };
652 }); 653 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/user_images_grid.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698