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

Unified Diff: chrome/browser/resources/options/options_page.js

Issue 6360016: dom-ui settings: Improve search field behavior.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: rebase Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/options.js ('k') | chrome/browser/resources/options/search_page.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/options_page.js
===================================================================
--- chrome/browser/resources/options/options_page.js (revision 72525)
+++ chrome/browser/resources/options/options_page.js (working copy)
@@ -43,6 +43,14 @@
OptionsPage.initialized_ = false;
/**
+ * Shows the default page.
+ */
+ OptionsPage.showDefaultPage = function() {
+ // TODO(csilv): Persist the current page.
+ this.showPageByName(BrowserOptions.getInstance().name);
+ };
+
+ /**
* Shows a registered page. This handles both top-level pages and sub-pages.
* @param {string} pageName Page name.
*/
@@ -339,15 +347,8 @@
};
};
- // Close the top overlay or sub-page on esc.
- document.addEventListener('keydown', function(e) {
- if (e.keyCode == 27) { // Esc
- if (self.isOverlayVisible_())
- self.clearOverlays();
- else
- self.closeTopSubPage();
- }
- });
+ // Install handler for key presses.
+ document.addEventListener('keydown', this.keyDownEventHandler_.bind(this));
};
/**
@@ -406,6 +407,21 @@
};
/**
+ * A function to handle key press events.
+ * @return {Event} a keydown event.
+ * @private
+ */
+ OptionsPage.keyDownEventHandler_ = function(event) {
+ // Close the top overlay or sub-page on esc.
+ if (event.keyCode == 27) { // Esc
+ if (this.isOverlayVisible_())
+ this.clearOverlays();
+ else
+ this.closeTopSubPage();
+ }
+ };
+
+ /**
* Re-initializes the C++ handlers if necessary. This is called if the
* handlers are torn down and recreated but the DOM may not have been (in
* which case |initialize| won't be called again). If |initialize| hasn't been
« no previous file with comments | « chrome/browser/resources/options/options.js ('k') | chrome/browser/resources/options/search_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698