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 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 var UserImagesGrid = options.UserImagesGrid; | 8 var UserImagesGrid = options.UserImagesGrid; |
9 var ButtonImages = UserImagesGrid.ButtonImages; | 9 var ButtonImages = UserImagesGrid.ButtonImages; |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 this.handleChooseFile_.bind(this)); | 61 this.handleChooseFile_.bind(this)); |
62 | 62 |
63 // Profile image data. | 63 // Profile image data. |
64 this.profileImage_ = imageGrid.addItem( | 64 this.profileImage_ = imageGrid.addItem( |
65 ButtonImages.PROFILE_PICTURE, | 65 ButtonImages.PROFILE_PICTURE, |
66 localStrings.getString('profilePhotoLoading')); | 66 localStrings.getString('profilePhotoLoading')); |
67 | 67 |
68 // Old user image data (if present). | 68 // Old user image data (if present). |
69 this.oldImage_ = null; | 69 this.oldImage_ = null; |
70 | 70 |
| 71 $('change-picture-overlay-confirm').onclick = this.closePage_; |
| 72 |
71 chrome.send('onChangePicturePageInitialized'); | 73 chrome.send('onChangePicturePageInitialized'); |
72 }, | 74 }, |
73 | 75 |
74 /** | 76 /** |
75 * Called right after the page has been shown to user. | 77 * Called right after the page has been shown to user. |
76 */ | 78 */ |
77 didShowPage: function() { | 79 didShowPage: function() { |
78 $('images-grid').updateAndFocus(); | 80 $('images-grid').updateAndFocus(); |
79 chrome.send('onChangePicturePageShown'); | 81 chrome.send('onChangePicturePageShown'); |
80 }, | 82 }, |
81 | 83 |
82 /** | 84 /** |
83 * Called right before the page is hidden. | 85 * Called right before the page is hidden. |
84 */ | 86 */ |
85 willHidePage: function() { | 87 willHidePage: function() { |
86 var imageGrid = $('images-grid'); | 88 var imageGrid = $('images-grid'); |
87 imageGrid.blur(); // Make sure the image grid is not active. | 89 imageGrid.blur(); // Make sure the image grid is not active. |
88 if (this.oldImage_) { | 90 if (this.oldImage_) { |
89 imageGrid.removeItem(this.oldImage_); | 91 imageGrid.removeItem(this.oldImage_); |
90 this.oldImage_ = null; | 92 this.oldImage_ = null; |
91 } | 93 } |
92 }, | 94 }, |
93 | 95 |
94 /** | 96 /** |
95 * Closes current page, returning back to Personal Stuff page. | 97 * Closes current page, returning back to Personal Stuff page. |
96 * @private | 98 * @private |
97 */ | 99 */ |
98 closePage_: function() { | 100 closePage_: function() { |
99 OptionsPage.navigateToPage('personal'); | 101 OptionsPage.closeOverlay(); |
100 }, | 102 }, |
101 | 103 |
102 /** | 104 /** |
103 * Handles "Take photo" button activation. | 105 * Handles "Take photo" button activation. |
104 * @private | 106 * @private |
105 */ | 107 */ |
106 handleTakePhoto_: function() { | 108 handleTakePhoto_: function() { |
107 chrome.send('takePhoto'); | 109 chrome.send('takePhoto'); |
108 this.closePage_(); | 110 this.closePage_(); |
109 }, | 111 }, |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 }; | 261 }; |
260 }); | 262 }); |
261 | 263 |
262 // Export | 264 // Export |
263 return { | 265 return { |
264 ChangePictureOptions: ChangePictureOptions | 266 ChangePictureOptions: ChangePictureOptions |
265 }; | 267 }; |
266 | 268 |
267 }); | 269 }); |
268 | 270 |
OLD | NEW |