Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: chrome/browser/resources/options2/options_page.js

Issue 9994005: Separate handler initialization from page initialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move anything that indirectly calls JS to InitializePage Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // OptionsPage class: 7 // OptionsPage class:
8 8
9 /** 9 /**
10 * Base class for options page. 10 * Base class for options page.
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 var topPage = OptionsPage.getTopmostVisiblePage(); 532 var topPage = OptionsPage.getTopmostVisiblePage();
533 if (topPage) 533 if (topPage)
534 this.setRootPageFrozen_(topPage.isOverlay); 534 this.setRootPageFrozen_(topPage.isOverlay);
535 }; 535 };
536 536
537 /** 537 /**
538 * Initializes the complete options page. This will cause all C++ handlers to 538 * Initializes the complete options page. This will cause all C++ handlers to
539 * be invoked to do final setup. 539 * be invoked to do final setup.
540 */ 540 */
541 OptionsPage.initialize = function() { 541 OptionsPage.initialize = function() {
542 chrome.send('coreOptionsInitialize'); 542 chrome.send('coreOptionsInitializePages');
543 this.initialized_ = true;
544 uber.onContentFrameLoaded(); 543 uber.onContentFrameLoaded();
545 544
546 this.fixedHeaders_ = document.querySelectorAll('header'); 545 this.fixedHeaders_ = document.querySelectorAll('header');
547 546
548 document.addEventListener('scroll', this.handleScroll_.bind(this)); 547 document.addEventListener('scroll', this.handleScroll_.bind(this));
549 548
550 // Trigger the scroll handler manually to set the initial state. 549 // Trigger the scroll handler manually to set the initial state.
551 this.handleScroll_(); 550 this.handleScroll_();
552 551
553 // Shake the dialog if the user clicks outside the dialog bounds. 552 // Shake the dialog if the user clicks outside the dialog bounds.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 OptionsPage.setClearPluginLSODataEnabled = function(enabled) { 621 OptionsPage.setClearPluginLSODataEnabled = function(enabled) {
623 if (enabled) { 622 if (enabled) {
624 document.documentElement.setAttribute( 623 document.documentElement.setAttribute(
625 'flashPluginSupportsClearSiteData', ''); 624 'flashPluginSupportsClearSiteData', '');
626 } else { 625 } else {
627 document.documentElement.removeAttribute( 626 document.documentElement.removeAttribute(
628 'flashPluginSupportsClearSiteData'); 627 'flashPluginSupportsClearSiteData');
629 } 628 }
630 }; 629 };
631 630
632 /**
633 * Re-initializes the C++ handlers if necessary. This is called if the
634 * handlers are torn down and recreated but the DOM may not have been (in
635 * which case |initialize| won't be called again). If |initialize| hasn't been
636 * called, this does nothing (since it will be later, once the DOM has
637 * finished loading).
638 */
639 OptionsPage.reinitializeCore = function() {
640 if (!this.initialized_)
641 chrome.send('coreOptionsInitialize');
642 };
643
644 OptionsPage.prototype = { 631 OptionsPage.prototype = {
645 __proto__: cr.EventTarget.prototype, 632 __proto__: cr.EventTarget.prototype,
646 633
647 /** 634 /**
648 * The parent page of this option page, or null for top-level pages. 635 * The parent page of this option page, or null for top-level pages.
649 * @type {OptionsPage} 636 * @type {OptionsPage}
650 */ 637 */
651 parentPage: null, 638 parentPage: null,
652 639
653 /** 640 /**
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 canShowPage: function() { 876 canShowPage: function() {
890 return true; 877 return true;
891 }, 878 },
892 }; 879 };
893 880
894 // Export 881 // Export
895 return { 882 return {
896 OptionsPage: OptionsPage 883 OptionsPage: OptionsPage
897 }; 884 };
898 }); 885 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/proxy_settings_ui.h » ('j') | chrome/browser/ui/webui/options2/options_ui2.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698