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 | 6 |
Dan Beam
2014/07/30 01:00:01
nit: remove \n
michaelpg
2014/07/30 21:42:19
Done.
| |
7 var OptionsPage = options.OptionsPage; | 7 var Page = cr.ui.pageManager.Page; |
8 var PageManager = cr.ui.pageManager.PageManager; | |
8 var UserImagesGrid = options.UserImagesGrid; | 9 var UserImagesGrid = options.UserImagesGrid; |
9 var ButtonImages = UserImagesGrid.ButtonImages; | 10 var ButtonImages = UserImagesGrid.ButtonImages; |
10 | 11 |
11 /** | 12 /** |
12 * Array of button URLs used on this page. | 13 * Array of button URLs used on this page. |
13 * @type {Array.<string>} | 14 * @type {Array.<string>} |
14 * @const | 15 * @const |
15 */ | 16 */ |
16 var ButtonImageUrls = [ | 17 var ButtonImageUrls = [ |
17 ButtonImages.TAKE_PHOTO, | 18 ButtonImages.TAKE_PHOTO, |
18 ButtonImages.CHOOSE_FILE | 19 ButtonImages.CHOOSE_FILE |
19 ]; | 20 ]; |
20 | 21 |
21 ///////////////////////////////////////////////////////////////////////////// | 22 ///////////////////////////////////////////////////////////////////////////// |
22 // ChangePictureOptions class: | 23 // ChangePictureOptions class: |
23 | 24 |
24 /** | 25 /** |
25 * Encapsulated handling of ChromeOS change picture options page. | 26 * Encapsulated handling of ChromeOS change picture options page. |
26 * @constructor | 27 * @constructor |
27 */ | 28 */ |
28 function ChangePictureOptions() { | 29 function ChangePictureOptions() { |
29 OptionsPage.call( | 30 Page.call(this, |
30 this, | 31 'changePicture', |
31 'changePicture', | 32 loadTimeData.getString('changePicturePage'), |
32 loadTimeData.getString('changePicturePage'), | 33 'change-picture-page'); |
33 'change-picture-page'); | |
34 } | 34 } |
35 | 35 |
36 cr.addSingletonGetter(ChangePictureOptions); | 36 cr.addSingletonGetter(ChangePictureOptions); |
37 | 37 |
38 ChangePictureOptions.prototype = { | 38 ChangePictureOptions.prototype = { |
39 // Inherit ChangePictureOptions from OptionsPage. | 39 // Inherit ChangePictureOptions from Page. |
40 __proto__: options.OptionsPage.prototype, | 40 __proto__: Page.prototype, |
41 | 41 |
42 /** | 42 /** |
43 * Initializes ChangePictureOptions page. | 43 * Initializes ChangePictureOptions page. |
44 */ | 44 */ |
45 initializePage: function() { | 45 initializePage: function() { |
46 // Call base class implementation to start preferences initialization. | 46 Page.prototype.initializePage.call(this); |
47 OptionsPage.prototype.initializePage.call(this); | |
48 | 47 |
49 var imageGrid = $('user-image-grid'); | 48 var imageGrid = $('user-image-grid'); |
50 UserImagesGrid.decorate(imageGrid); | 49 UserImagesGrid.decorate(imageGrid); |
51 | 50 |
52 // Preview image will track the selected item's URL. | 51 // Preview image will track the selected item's URL. |
53 var previewElement = $('user-image-preview'); | 52 var previewElement = $('user-image-preview'); |
54 previewElement.oncontextmenu = function(e) { e.preventDefault(); }; | 53 previewElement.oncontextmenu = function(e) { e.preventDefault(); }; |
55 | 54 |
56 imageGrid.previewElement = previewElement; | 55 imageGrid.previewElement = previewElement; |
57 imageGrid.selectionType = 'default'; | 56 imageGrid.selectionType = 'default'; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 didClosePage: function() { | 140 didClosePage: function() { |
142 this.willHidePage(); | 141 this.willHidePage(); |
143 }, | 142 }, |
144 | 143 |
145 /** | 144 /** |
146 * Closes the overlay, returning to the main settings page. | 145 * Closes the overlay, returning to the main settings page. |
147 * @private | 146 * @private |
148 */ | 147 */ |
149 closeOverlay_: function() { | 148 closeOverlay_: function() { |
150 if (!$('change-picture-page').hidden) | 149 if (!$('change-picture-page').hidden) |
151 OptionsPage.closeOverlay(); | 150 PageManager.closeOverlay(); |
152 }, | 151 }, |
153 | 152 |
154 /** | 153 /** |
155 * Handle camera-photo flip. | 154 * Handle camera-photo flip. |
156 */ | 155 */ |
157 handleFlipPhoto_: function() { | 156 handleFlipPhoto_: function() { |
158 var imageGrid = $('user-image-grid'); | 157 var imageGrid = $('user-image-grid'); |
159 imageGrid.previewElement.classList.add('animation'); | 158 imageGrid.previewElement.classList.add('animation'); |
160 imageGrid.flipPhoto = !imageGrid.flipPhoto; | 159 imageGrid.flipPhoto = !imageGrid.flipPhoto; |
161 var flipMessageId = imageGrid.flipPhoto ? | 160 var flipMessageId = imageGrid.flipPhoto ? |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 return instance[name + '_'].apply(instance, arguments); | 340 return instance[name + '_'].apply(instance, arguments); |
342 }; | 341 }; |
343 }); | 342 }); |
344 | 343 |
345 // Export | 344 // Export |
346 return { | 345 return { |
347 ChangePictureOptions: ChangePictureOptions | 346 ChangePictureOptions: ChangePictureOptions |
348 }; | 347 }; |
349 | 348 |
350 }); | 349 }); |
OLD | NEW |