| 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 // TODO(sail): Refactor options_page and remove this include. | 5 // TODO(sail): Refactor options_page and remove this include. |
| 6 <include src="../options/options_page.js"/> | 6 <include src="../options/options_page.js"/> |
| 7 <include src="../shared/js/util.js"/> |
| 7 <include src="../sync_setup_overlay.js"/> | 8 <include src="../sync_setup_overlay.js"/> |
| 8 | 9 |
| 9 cr.define('sync_promo', function() { | 10 cr.define('sync_promo', function() { |
| 10 /** | 11 /** |
| 11 * SyncPromo class | 12 * SyncPromo class |
| 12 * Subclass of options.SyncSetupOverlay that customizes the sync setup | 13 * Subclass of options.SyncSetupOverlay that customizes the sync setup |
| 13 * overlay for use in the new tab page. | 14 * overlay for use in the new tab page. |
| 14 * @class | 15 * @class |
| 15 */ | 16 */ |
| 16 function SyncPromo() { | 17 function SyncPromo() { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 advancedOptionsClickedAlready = true; | 126 advancedOptionsClickedAlready = true; |
| 126 }); | 127 }); |
| 127 | 128 |
| 128 // Re-used across both cancel buttons after a successful sign in. | 129 // Re-used across both cancel buttons after a successful sign in. |
| 129 var cancelFunc = function() { | 130 var cancelFunc = function() { |
| 130 chrome.send('SyncPromo:UserFlowAction', | 131 chrome.send('SyncPromo:UserFlowAction', |
| 131 [actions.CANCELLED_AFTER_SIGN_IN]); | 132 [actions.CANCELLED_AFTER_SIGN_IN]); |
| 132 }; | 133 }; |
| 133 $('confirm-everything-cancel').addEventListener('click', cancelFunc); | 134 $('confirm-everything-cancel').addEventListener('click', cancelFunc); |
| 134 $('choose-datatypes-cancel').addEventListener('click', cancelFunc); | 135 $('choose-datatypes-cancel').addEventListener('click', cancelFunc); |
| 136 |
| 137 // Add the source parameter to the document so that it can be used to |
| 138 // selectively show and hide elements using CSS. |
| 139 var params = parseQueryParams(document.location); |
| 140 if (params.source == '0') |
| 141 document.documentElement.setAttribute('isstartup', ''); |
| 135 }, | 142 }, |
| 136 | 143 |
| 137 /** | 144 /** |
| 138 * Called when the page is unloading to record number of times a user tried | 145 * Called when the page is unloading to record number of times a user tried |
| 139 * to sign in and if they left while a throbber was running. | 146 * to sign in and if they left while a throbber was running. |
| 140 * @private | 147 * @private |
| 141 */ | 148 */ |
| 142 recordPageViewActions_: function() { | 149 recordPageViewActions_: function() { |
| 143 chrome.send('SyncPromo:RecordSignInAttempts', [this.signInAttempts_]); | 150 chrome.send('SyncPromo:RecordSignInAttempts', [this.signInAttempts_]); |
| 144 if (this.throbberStart_) | 151 if (this.throbberStart_) |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 return { | 231 return { |
| 225 SyncPromo: SyncPromo | 232 SyncPromo: SyncPromo |
| 226 }; | 233 }; |
| 227 }); | 234 }); |
| 228 | 235 |
| 229 var OptionsPage = options.OptionsPage; | 236 var OptionsPage = options.OptionsPage; |
| 230 var SyncSetupOverlay = sync_promo.SyncPromo; | 237 var SyncSetupOverlay = sync_promo.SyncPromo; |
| 231 window.addEventListener('DOMContentLoaded', sync_promo.SyncPromo.initialize); | 238 window.addEventListener('DOMContentLoaded', sync_promo.SyncPromo.initialize); |
| 232 window.addEventListener('beforeunload', | 239 window.addEventListener('beforeunload', |
| 233 sync_promo.SyncPromo.recordPageViewActions.bind(sync_promo.SyncPromo)); | 240 sync_promo.SyncPromo.recordPageViewActions.bind(sync_promo.SyncPromo)); |
| OLD | NEW |