| Index: chrome/browser/resources/settings/settings_main/settings_main.js
|
| diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
|
| index 5d9dd81c119ed6873abf7b03e5335da9e74d14f7..c8502d662e6540505de031e376e89eaffd1bcec9 100644
|
| --- a/chrome/browser/resources/settings/settings_main/settings_main.js
|
| +++ b/chrome/browser/resources/settings/settings_main/settings_main.js
|
| @@ -3,7 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| /**
|
| - * @typedef {{about: boolean, basic: boolean, advanced: boolean}}
|
| + * @typedef {{about: boolean, settings: boolean}}
|
| */
|
| var MainPageVisibility;
|
|
|
| @@ -28,16 +28,8 @@ Polymer({
|
| advancedToggleExpanded: {
|
| type: Boolean,
|
| notify: true,
|
| - observer: 'updatePagesShown_',
|
| },
|
|
|
| - /**
|
| - * True if a section is fully expanded to hide other sections beneath it.
|
| - * Not true otherwise (even while animating a section open/closed).
|
| - * @private
|
| - */
|
| - hasExpandedSection_: Boolean,
|
| -
|
| /** @private */
|
| overscroll_: {
|
| type: Number,
|
| @@ -46,13 +38,13 @@ Polymer({
|
|
|
| /**
|
| * Controls which main pages are displayed via dom-ifs, based on the current
|
| - * route and the Advanced toggle state.
|
| + * route.
|
| * @private {!MainPageVisibility}
|
| */
|
| showPages_: {
|
| type: Object,
|
| value: function() {
|
| - return {about: false, basic: false, advanced: false};
|
| + return {about: false, settings: false};
|
| },
|
| },
|
|
|
| @@ -91,8 +83,6 @@ Polymer({
|
| /** @override */
|
| attached: function() {
|
| this.listen(this, 'freeze-scroll', 'onFreezeScroll_');
|
| - var currentRoute = settings.getCurrentRoute();
|
| - this.hasExpandedSection_ = currentRoute && currentRoute.isSubpage();
|
| },
|
|
|
| /** @override */
|
| @@ -160,84 +150,24 @@ Polymer({
|
| }
|
| },
|
|
|
| - /**
|
| - * @param {boolean} opened Whether the menu is expanded.
|
| - * @return {string} Which icon to use.
|
| - * @private
|
| - */
|
| - arrowState_: function(opened) {
|
| - return opened ? 'settings:arrow-drop-up' : 'cr:arrow-drop-down';
|
| - },
|
| -
|
| - /**
|
| - * @return {boolean}
|
| - * @private
|
| - */
|
| - showAdvancedToggle_: function() {
|
| - return !this.inSearchMode_ && this.showPages_.basic &&
|
| - !this.hasExpandedSection_;
|
| - },
|
| -
|
| - /**
|
| - * @return {boolean} Whether to show the basic page, taking into account both
|
| - * routing and search state.
|
| - * @private
|
| - */
|
| - showBasicPage_: function() {
|
| - return this.showPages_.basic || (
|
| - this.inSearchMode_ && !this.hasExpandedSection_);
|
| - },
|
| -
|
| - /**
|
| - * @return {boolean} Whether to show the advanced page, taking into account
|
| - * both routing and search state.
|
| - * @private
|
| - */
|
| - showAdvancedPage_: function() {
|
| - return this.showPages_.advanced || (
|
| - this.inSearchMode_ && !this.hasExpandedSection_);
|
| - },
|
| -
|
| /** @param {!settings.Route} newRoute */
|
| currentRouteChanged: function(newRoute) {
|
| - // When the route changes from a sub-page to the main page, immediately
|
| - // update hasExpandedSection_ to unhide the other sections.
|
| - if (!newRoute.isSubpage())
|
| - this.hasExpandedSection_ = false;
|
| -
|
| - if (settings.Route.ADVANCED.contains(newRoute))
|
| - this.advancedToggleExpanded = true;
|
| -
|
| this.updatePagesShown_();
|
| },
|
|
|
| /** @private */
|
| onSubpageExpand_: function() {
|
| - // The subpage finished expanding fully. Hide pages other than the current
|
| - // section's parent page.
|
| - this.hasExpandedSection_ = true;
|
| this.updatePagesShown_();
|
| },
|
|
|
| /**
|
| - * Updates the hidden state of the about, basic and advanced pages, based on
|
| - * the current route and the Advanced toggle state.
|
| + * Updates the hidden state of the about and settings pages based on the
|
| + * current route.
|
| * @private
|
| */
|
| updatePagesShown_: function() {
|
| - var currentRoute = settings.getCurrentRoute();
|
| - if (settings.Route.ABOUT.contains(currentRoute)) {
|
| - this.showPages_ = {about: true, basic: false, advanced: false};
|
| - } else {
|
| - this.showPages_ = {
|
| - about: false,
|
| - basic: settings.Route.BASIC.contains(currentRoute) ||
|
| - !this.hasExpandedSection_,
|
| - advanced: this.hasExpandedSection_ ?
|
| - settings.Route.ADVANCED.contains(currentRoute) :
|
| - this.advancedToggleExpanded,
|
| - };
|
| - }
|
| + var inAbout = settings.Route.ABOUT.contains(settings.getCurrentRoute());
|
| + this.showPages_ = {about: inAbout, settings: !inAbout};
|
|
|
| // Calculate and set the overflow padding.
|
| this.updateOverscrollForPage_();
|
| @@ -290,27 +220,18 @@ Polymer({
|
| return Math.max(0, this.offsetParent.clientHeight - distance);
|
| },
|
|
|
| - /** @private */
|
| - toggleAdvancedPage_: function() {
|
| - this.advancedToggleExpanded = !this.advancedToggleExpanded;
|
| - },
|
| -
|
| /**
|
| * Returns the root page (if it exists) for a route.
|
| * @param {!settings.Route} route
|
| - * @return {(?SettingsAboutPageElement|?SettingsAdvancedPageElement|
|
| - * ?SettingsBasicPageElement)}
|
| + * @return {(?SettingsAboutPageElement|?SettingsBasicPageElement)}
|
| */
|
| getPage_: function(route) {
|
| if (settings.Route.ABOUT.contains(route)) {
|
| return /** @type {?SettingsAboutPageElement} */(
|
| this.$$('settings-about-page'));
|
| }
|
| - if (settings.Route.ADVANCED.contains(route)) {
|
| - return /** @type {?SettingsAdvancedPageElement} */(
|
| - this.$$('settings-advanced-page'));
|
| - }
|
| - if (settings.Route.BASIC.contains(route)) {
|
| + if (settings.Route.BASIC.contains(route) ||
|
| + settings.Route.ADVANCED.contains(route)) {
|
| return /** @type {?SettingsBasicPageElement} */(
|
| this.$$('settings-basic-page'));
|
| }
|
| @@ -328,14 +249,8 @@ Polymer({
|
|
|
| return new Promise(function(resolve, reject) {
|
| setTimeout(function() {
|
| - var whenSearchDone = settings.getSearchManager().search(
|
| - query, assert(this.getPage_(settings.Route.BASIC)));
|
| -
|
| - if (this.pageVisibility.advancedSettings !== false) {
|
| - assert(whenSearchDone === settings.getSearchManager().search(
|
| - query, assert(this.getPage_(settings.Route.ADVANCED))));
|
| - }
|
| -
|
| + var whenSearchDone =
|
| + assert(this.getPage_(settings.Route.BASIC)).searchContents(query);
|
| whenSearchDone.then(function(request) {
|
| resolve();
|
| if (!request.finished) {
|
| @@ -353,13 +268,4 @@ Polymer({
|
| }.bind(this), 0);
|
| }.bind(this));
|
| },
|
| -
|
| - /**
|
| - * @param {(boolean|undefined)} visibility
|
| - * @return {boolean} True unless visibility is false.
|
| - * @private
|
| - */
|
| - showAdvancedSettings_: function(visibility) {
|
| - return visibility !== false;
|
| - },
|
| });
|
|
|