Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright 2015 The Chromium Authors. All rights reserved. | 1 /* Copyright 2015 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('sync.confirmation', function() { | 5 cr.define('sync.confirmation', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 function onConfirm(e) { | 8 function onConfirm(e) { |
| 9 chrome.send('confirm'); | 9 chrome.send('confirm'); |
| 10 } | 10 } |
| 11 | 11 |
| 12 function onUndo(e) { | 12 function onUndo(e) { |
| 13 chrome.send('undo'); | 13 chrome.send('undo'); |
| 14 } | 14 } |
| 15 | 15 |
| 16 function onGoToSettings(e) { | 16 function onGoToSettings(e) { |
| 17 chrome.send('goToSettings'); | 17 chrome.send('goToSettings'); |
| 18 } | 18 } |
| 19 | 19 |
| 20 function initialize() { | 20 function initialize() { |
| 21 $('confirmButton').addEventListener('click', onConfirm); | 21 $('confirmButton').addEventListener('click', onConfirm); |
| 22 $('undoButton').addEventListener('click', onUndo); | 22 $('undoButton').addEventListener('click', onUndo); |
| 23 $('settingsLink').addEventListener('click', onGoToSettings); | 23 $('settingsLink').addEventListener('click', onGoToSettings); |
| 24 $('profile-picture').addEventListener('load', onPictureLoaded); | 24 $('profile-picture').addEventListener('load', onPictureLoaded); |
| 25 chrome.send('initialized'); | 25 chrome.send('initialized'); |
| 26 chrome.send('resizeNativeView', [document.body.scrollHeight]); | |
|
Dan Beam
2016/04/05 06:42:41
nit: why do you need both 'initialized' and 'resiz
anthonyvd
2016/04/05 14:24:48
Good point, they don't need to be separate. Done.
| |
| 26 } | 27 } |
| 27 | 28 |
| 28 function setUserImageURL(url) { | 29 function setUserImageURL(url) { |
| 29 $('profile-picture').src = url; | 30 $('profile-picture').src = url; |
| 30 } | 31 } |
| 31 | 32 |
| 32 function onPictureLoaded(e) { | 33 function onPictureLoaded(e) { |
| 33 $('picture-container').classList.add('loaded'); | 34 $('picture-container').classList.add('loaded'); |
| 34 } | 35 } |
| 35 | 36 |
| 36 return { | 37 return { |
| 37 initialize: initialize, | 38 initialize: initialize, |
| 38 setUserImageURL: setUserImageURL | 39 setUserImageURL: setUserImageURL |
| 39 }; | 40 }; |
| 40 }); | 41 }); |
| 41 | 42 |
| 42 document.addEventListener('DOMContentLoaded', sync.confirmation.initialize); | 43 document.addEventListener('DOMContentLoaded', sync.confirmation.initialize); |
| OLD | NEW |