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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 imageUrl = UserImagesGrid.ButtonImages.TAKE_PHOTO; | 322 imageUrl = UserImagesGrid.ButtonImages.TAKE_PHOTO; |
323 if (imageUrl) { | 323 if (imageUrl) { |
324 this.cameraImage_ = this.cameraImage_ ? | 324 this.cameraImage_ = this.cameraImage_ ? |
325 this.updateItem(this.cameraImage_, imageUrl) : | 325 this.updateItem(this.cameraImage_, imageUrl) : |
326 this.addItem(imageUrl, this.cameraTitle_, undefined, 0); | 326 this.addItem(imageUrl, this.cameraTitle_, undefined, 0); |
327 this.cameraImage_.type = 'camera'; | 327 this.cameraImage_.type = 'camera'; |
328 } else { | 328 } else { |
329 this.removeItem(this.cameraImage_); | 329 this.removeItem(this.cameraImage_); |
330 this.cameraImage_ = null; | 330 this.cameraImage_ = null; |
331 } | 331 } |
332 this.focus(); | 332 |
| 333 // Set focus to the grid, unless focus is on the OK button. |
| 334 if (!document.activeElement || document.activeElement.tagName != 'BUTTON') |
| 335 this.focus(); |
333 }, | 336 }, |
334 | 337 |
335 /** | 338 /** |
336 * Title for the camera element. Must be set before setting |cameraImage| | 339 * Title for the camera element. Must be set before setting |cameraImage| |
337 * for the first time. | 340 * for the first time. |
338 * @type {string} | 341 * @type {string} |
339 */ | 342 */ |
340 set cameraTitle(value) { | 343 set cameraTitle(value) { |
341 return this.cameraTitle_ = value; | 344 return this.cameraTitle_ = value; |
342 }, | 345 }, |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 UserImagesGrid.ButtonImages = { | 651 UserImagesGrid.ButtonImages = { |
649 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', | 652 TAKE_PHOTO: 'chrome://theme/IDR_BUTTON_USER_IMAGE_TAKE_PHOTO', |
650 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', | 653 CHOOSE_FILE: 'chrome://theme/IDR_BUTTON_USER_IMAGE_CHOOSE_FILE', |
651 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' | 654 PROFILE_PICTURE: 'chrome://theme/IDR_PROFILE_PICTURE_LOADING' |
652 }; | 655 }; |
653 | 656 |
654 return { | 657 return { |
655 UserImagesGrid: UserImagesGrid | 658 UserImagesGrid: UserImagesGrid |
656 }; | 659 }; |
657 }); | 660 }); |
OLD | NEW |