| 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 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 document.addEventListener('keydown', onKeyDown); | 21 document.addEventListener('keydown', onKeyDown); |
| 22 $('confirmButton').addEventListener('click', onConfirm); | 22 $('confirmButton').addEventListener('click', onConfirm); |
| 23 $('undoButton').addEventListener('click', onUndo); | 23 $('undoButton').addEventListener('click', onUndo); |
| 24 if (loadTimeData.getBoolean('isSyncAllowed')) { | 24 if (loadTimeData.getBoolean('isSyncAllowed')) { |
| 25 $('settingsLink').addEventListener('click', onGoToSettings); | 25 $('settingsLink').addEventListener('click', onGoToSettings); |
| 26 $('profile-picture').addEventListener('load', onPictureLoaded); | 26 $('profile-picture').addEventListener('load', onPictureLoaded); |
| 27 $('syncDisabledDetails').hidden = true; | 27 $('syncDisabledDetails').hidden = true; |
| 28 } else { | 28 } else { |
| 29 $('syncConfirmationDetails').hidden = true; | 29 $('syncConfirmationDetails').hidden = true; |
| 30 } | 30 } |
| 31 chrome.send('initializedWithSize', [document.body.scrollHeight]); | 31 |
| 32 // Prefer using |document.body.offsetHeight| instead of |
| 33 // |document.body.scrollHeight| as it returns the correct height of the |
| 34 // even when the page zoom in Chrome is different than 100%. |
| 35 chrome.send('initializedWithSize', [document.body.offsetHeight]); |
| 32 } | 36 } |
| 33 | 37 |
| 34 function clearFocus() { | 38 function clearFocus() { |
| 35 document.activeElement.blur(); | 39 document.activeElement.blur(); |
| 36 } | 40 } |
| 37 | 41 |
| 38 function setUserImageURL(url) { | 42 function setUserImageURL(url) { |
| 39 if (loadTimeData.getBoolean('isSyncAllowed')) { | 43 if (loadTimeData.getBoolean('isSyncAllowed')) { |
| 40 $('profile-picture').src = url; | 44 $('profile-picture').src = url; |
| 41 } | 45 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 59 } | 63 } |
| 60 | 64 |
| 61 return { | 65 return { |
| 62 clearFocus: clearFocus, | 66 clearFocus: clearFocus, |
| 63 initialize: initialize, | 67 initialize: initialize, |
| 64 setUserImageURL: setUserImageURL | 68 setUserImageURL: setUserImageURL |
| 65 }; | 69 }; |
| 66 }); | 70 }); |
| 67 | 71 |
| 68 document.addEventListener('DOMContentLoaded', sync.confirmation.initialize); | 72 document.addEventListener('DOMContentLoaded', sync.confirmation.initialize); |
| OLD | NEW |