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

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: estade review 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 628 }
630 }; 629 };
631 630
632 /** 631 /**
633 * Re-initializes the C++ handlers if necessary. This is called if the 632 * 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 633 * 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 634 * 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 635 * called, this does nothing (since it will be later, once the DOM has
637 * finished loading). 636 * finished loading).
638 */ 637 */
639 OptionsPage.reinitializeCore = function() { 638 OptionsPage.reinitializeCore = function() {
Dan Beam 2012/04/05 21:38:21 And if we remove that other stuff, we can probably
640 if (!this.initialized_) 639 if (!this.initialized_) {
641 chrome.send('coreOptionsInitialize'); 640 chrome.send('coreOptionsInitializeHandlers');
641 this.initialized_ = true;
642 }
642 }; 643 };
643 644
644 OptionsPage.prototype = { 645 OptionsPage.prototype = {
645 __proto__: cr.EventTarget.prototype, 646 __proto__: cr.EventTarget.prototype,
646 647
647 /** 648 /**
648 * The parent page of this option page, or null for top-level pages. 649 * The parent page of this option page, or null for top-level pages.
649 * @type {OptionsPage} 650 * @type {OptionsPage}
650 */ 651 */
651 parentPage: null, 652 parentPage: null,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 canShowPage: function() { 890 canShowPage: function() {
890 return true; 891 return true;
891 }, 892 },
892 }; 893 };
893 894
894 // Export 895 // Export
895 return { 896 return {
896 OptionsPage: OptionsPage 897 OptionsPage: OptionsPage
897 }; 898 };
898 }); 899 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698