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

Side by Side Diff: chrome/browser/resources/options/chromeos/change_picture_options.js

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ugh just no Created 6 years, 4 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
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 cr.define('options', function() { 5 cr.define('options', function() {
6 6 var Page = cr.ui.pageManager.Page;
7 var OptionsPage = options.OptionsPage; 7 var PageManager = cr.ui.pageManager.PageManager;
8 var UserImagesGrid = options.UserImagesGrid; 8 var UserImagesGrid = options.UserImagesGrid;
9 var ButtonImages = UserImagesGrid.ButtonImages; 9 var ButtonImages = UserImagesGrid.ButtonImages;
10 10
11 /** 11 /**
12 * Array of button URLs used on this page. 12 * Array of button URLs used on this page.
13 * @type {Array.<string>} 13 * @type {Array.<string>}
14 * @const 14 * @const
15 */ 15 */
16 var ButtonImageUrls = [ 16 var ButtonImageUrls = [
17 ButtonImages.TAKE_PHOTO, 17 ButtonImages.TAKE_PHOTO,
18 ButtonImages.CHOOSE_FILE 18 ButtonImages.CHOOSE_FILE
19 ]; 19 ];
20 20
21 ///////////////////////////////////////////////////////////////////////////// 21 /////////////////////////////////////////////////////////////////////////////
22 // ChangePictureOptions class: 22 // ChangePictureOptions class:
23 23
24 /** 24 /**
25 * Encapsulated handling of ChromeOS change picture options page. 25 * Encapsulated handling of ChromeOS change picture options page.
26 * @constructor 26 * @constructor
27 */ 27 */
28 function ChangePictureOptions() { 28 function ChangePictureOptions() {
29 OptionsPage.call( 29 Page.call(this, 'changePicture',
30 this, 30 loadTimeData.getString('changePicturePage'),
31 'changePicture', 31 'change-picture-page');
32 loadTimeData.getString('changePicturePage'),
33 'change-picture-page');
34 } 32 }
35 33
36 cr.addSingletonGetter(ChangePictureOptions); 34 cr.addSingletonGetter(ChangePictureOptions);
37 35
38 ChangePictureOptions.prototype = { 36 ChangePictureOptions.prototype = {
39 // Inherit ChangePictureOptions from OptionsPage. 37 // Inherit ChangePictureOptions from Page.
40 __proto__: options.OptionsPage.prototype, 38 __proto__: Page.prototype,
41 39
42 /** @override */ 40 /** @override */
43 initializePage: function() { 41 initializePage: function() {
44 // Call base class implementation to start preferences initialization. 42 Page.prototype.initializePage.call(this);
45 OptionsPage.prototype.initializePage.call(this);
46 43
47 var imageGrid = $('user-image-grid'); 44 var imageGrid = $('user-image-grid');
48 UserImagesGrid.decorate(imageGrid); 45 UserImagesGrid.decorate(imageGrid);
49 46
50 // Preview image will track the selected item's URL. 47 // Preview image will track the selected item's URL.
51 var previewElement = $('user-image-preview'); 48 var previewElement = $('user-image-preview');
52 previewElement.oncontextmenu = function(e) { e.preventDefault(); }; 49 previewElement.oncontextmenu = function(e) { e.preventDefault(); };
53 50
54 imageGrid.previewElement = previewElement; 51 imageGrid.previewElement = previewElement;
55 imageGrid.selectionType = 'default'; 52 imageGrid.selectionType = 'default';
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 didClosePage: function() { 136 didClosePage: function() {
140 this.willHidePage(); 137 this.willHidePage();
141 }, 138 },
142 139
143 /** 140 /**
144 * Closes the overlay, returning to the main settings page. 141 * Closes the overlay, returning to the main settings page.
145 * @private 142 * @private
146 */ 143 */
147 closeOverlay_: function() { 144 closeOverlay_: function() {
148 if (!$('change-picture-page').hidden) 145 if (!$('change-picture-page').hidden)
149 OptionsPage.closeOverlay(); 146 PageManager.closeOverlay();
150 }, 147 },
151 148
152 /** 149 /**
153 * Handle camera-photo flip. 150 * Handle camera-photo flip.
154 */ 151 */
155 handleFlipPhoto_: function() { 152 handleFlipPhoto_: function() {
156 var imageGrid = $('user-image-grid'); 153 var imageGrid = $('user-image-grid');
157 imageGrid.previewElement.classList.add('animation'); 154 imageGrid.previewElement.classList.add('animation');
158 imageGrid.flipPhoto = !imageGrid.flipPhoto; 155 imageGrid.flipPhoto = !imageGrid.flipPhoto;
159 var flipMessageId = imageGrid.flipPhoto ? 156 var flipMessageId = imageGrid.flipPhoto ?
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return instance[name + '_'].apply(instance, arguments); 336 return instance[name + '_'].apply(instance, arguments);
340 }; 337 };
341 }); 338 });
342 339
343 // Export 340 // Export
344 return { 341 return {
345 ChangePictureOptions: ChangePictureOptions 342 ChangePictureOptions: ChangePictureOptions
346 }; 343 };
347 344
348 }); 345 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698