| 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="../options2/options_page.js"/> | 6 <include src="../options2/options_page.js"/> |
| 7 <include src="../shared/js/util.js"/> | 7 <include src="../shared/js/util.js"/> |
| 8 <include src="../sync_setup_overlay.js"/> | 8 <include src="../sync_setup_overlay.js"/> |
| 9 | 9 |
| 10 cr.define('sync_promo', function() { | 10 cr.define('sync_promo', function() { |
| 11 /** | 11 /** |
| 12 * SyncPromo class | 12 * SyncPromo class |
| 13 * Subclass of options.SyncSetupOverlay that customizes the sync setup | 13 * Subclass of options.SyncSetupOverlay that customizes the sync setup |
| 14 * overlay for use in the new tab page. | 14 * overlay for use in the new tab page. |
| 15 * @class | 15 * @class |
| 16 */ | 16 */ |
| 17 function SyncPromo() { | 17 function SyncPromo() { |
| 18 options.SyncSetupOverlay.call(this, 'syncSetup', | 18 options.SyncSetupOverlay.call(this, 'syncSetup', |
| 19 templateData.syncSetupOverlayTabTitle, | 19 loadTimeData.getString('syncSetupOverlayTabTitle'), |
| 20 'sync-setup-overlay'); | 20 'sync-setup-overlay'); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Replicating enum from chrome/common/extensions/extension_constants.h. | 23 // Replicating enum from chrome/common/extensions/extension_constants.h. |
| 24 /** @const */ var actions = (function() { | 24 /** @const */ var actions = (function() { |
| 25 var i = 0; | 25 var i = 0; |
| 26 return { | 26 return { |
| 27 VIEWED: i++, | 27 VIEWED: i++, |
| 28 LEARN_MORE_CLICKED: i++, | 28 LEARN_MORE_CLICKED: i++, |
| 29 ACCOUNT_HELP_CLICKED: i++, | 29 ACCOUNT_HELP_CLICKED: i++, |
| 30 CREATE_ACCOUNT_CLICKED: i++, | 30 CREATE_ACCOUNT_CLICKED: i++, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 49 showOverlay_: function() { | 49 showOverlay_: function() { |
| 50 $('sync-setup-overlay').hidden = false; | 50 $('sync-setup-overlay').hidden = false; |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 closeOverlay_: function() { | 53 closeOverlay_: function() { |
| 54 chrome.send('SyncPromo:Close'); | 54 chrome.send('SyncPromo:Close'); |
| 55 }, | 55 }, |
| 56 | 56 |
| 57 // Initializes the page. | 57 // Initializes the page. |
| 58 initializePage: function() { | 58 initializePage: function() { |
| 59 localStrings = new LocalStrings(); | |
| 60 | |
| 61 options.SyncSetupOverlay.prototype.initializePage.call(this); | 59 options.SyncSetupOverlay.prototype.initializePage.call(this); |
| 62 | 60 |
| 63 // Hide parts of the login UI and show the promo UI. | 61 // Hide parts of the login UI and show the promo UI. |
| 64 this.hideOuterLoginUI_(); | 62 this.hideOuterLoginUI_(); |
| 65 $('promo-skip').hidden = false; | 63 $('promo-skip').hidden = false; |
| 66 | 64 |
| 67 this.showSetupUI_(); | 65 this.showSetupUI_(); |
| 68 chrome.send('SyncPromo:Initialize'); | 66 chrome.send('SyncPromo:Initialize'); |
| 69 | 67 |
| 70 var self = this; | 68 var self = this; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return { | 229 return { |
| 232 SyncPromo: SyncPromo | 230 SyncPromo: SyncPromo |
| 233 }; | 231 }; |
| 234 }); | 232 }); |
| 235 | 233 |
| 236 var OptionsPage = options.OptionsPage; | 234 var OptionsPage = options.OptionsPage; |
| 237 var SyncSetupOverlay = sync_promo.SyncPromo; | 235 var SyncSetupOverlay = sync_promo.SyncPromo; |
| 238 window.addEventListener('DOMContentLoaded', sync_promo.SyncPromo.initialize); | 236 window.addEventListener('DOMContentLoaded', sync_promo.SyncPromo.initialize); |
| 239 window.addEventListener('beforeunload', | 237 window.addEventListener('beforeunload', |
| 240 sync_promo.SyncPromo.recordPageViewActions.bind(sync_promo.SyncPromo)); | 238 sync_promo.SyncPromo.recordPageViewActions.bind(sync_promo.SyncPromo)); |
| OLD | NEW |