Commit 6000aea8 authored by shans's avatar shans Committed by Commit bot

Revert of MD Settings: make chrome://[md-]settings/clearBrowserData URL work...

Revert of MD Settings: make chrome://[md-]settings/clearBrowserData URL work (patchset #7 id:120001 of https://codereview.chromium.org/2094223004/ )

Reason for revert:
Looks like this is causing CrSettingsPrivacyPageTest.PrivacyPage to fail on Mac10.9 and Mac ASAN

Original issue's description:
> MD Settings: make chrome://[md-]settings/clearBrowserData URL work
>
> R=michaelpg@chromium.org
> BUG=622037
> CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation
>
> Committed: https://crrev.com/a6ecac07f74cf819dc164bb91f721e596c261cd2
> Cr-Commit-Position: refs/heads/master@{#402614}

TBR=michaelpg@chromium.org,dbeam@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=622037

Review-Url: https://codereview.chromium.org/2103653004
Cr-Commit-Position: refs/heads/master@{#402651}
parent 7ebfaa0c
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
'people_page/compiled_resources2.gyp:*', 'people_page/compiled_resources2.gyp:*',
'prefs/compiled_resources2.gyp:*', 'prefs/compiled_resources2.gyp:*',
'printing_page/compiled_resources2.gyp:*', 'printing_page/compiled_resources2.gyp:*',
'privacy_page/compiled_resources2.gyp:*',
'reset_page/compiled_resources2.gyp:*', 'reset_page/compiled_resources2.gyp:*',
'settings_main/compiled_resources2.gyp:*', 'settings_main/compiled_resources2.gyp:*',
'settings_page/compiled_resources2.gyp:*', 'settings_page/compiled_resources2.gyp:*',
......
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'privacy_page_browser_proxy',
'dependencies': [
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
'<(EXTERNS_GYP):chrome_send',
],
'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
},
{
'target_name': 'privacy_page',
'dependencies': [
'privacy_page_browser_proxy',
'../site_settings/compiled_resources2.gyp:constants',
'../settings_main/compiled_resources2.gyp:settings_main',
'../settings_page/compiled_resources2.gyp:settings_animated_pages',
],
'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
},
],
}
...@@ -28,41 +28,17 @@ Polymer({ ...@@ -28,41 +28,17 @@ Polymer({
}, },
/** @private */ /** @private */
showClearBrowsingDataDialog_: { showClearBrowsingDataDialog_: Boolean,
computed: 'computeShowClearBrowsingDataDialog_(currentRoute)',
type: Boolean,
},
}, },
ready: function() { ready: function() {
this.ContentSettingsTypes = settings.ContentSettingsTypes; this.ContentSettingsTypes = settings.ContentSettingsTypes;
}, },
/** @suppress {missingProperties} */
attached: function() {
settings.main.rendered.then(function() {
if (this.showClearBrowsingDataDialog_) {
var dialog = this.$$('settings-clear-browsing-data-dialog').$.dialog;
// TODO(dbeam): cast to a CrDialogElement when it compiles.
dialog.refit();
}
}.bind(this));
},
/**
* @return {boolean} Whether the Clear Browsing Data dialog should be showing.
* @private
*/
computeShowClearBrowsingDataDialog_: function() {
var route = this.currentRoute;
return route && route.dialog == 'clear-browsing-data';
},
/** @private */ /** @private */
onManageCertificatesTap_: function() { onManageCertificatesTap_: function() {
<if expr="use_nss_certs"> <if expr="use_nss_certs">
var pages = /** @type {!SettingsAnimatedPagesElement} */(this.$.pages); this.$.pages.setSubpageChain(['manage-certificates']);
pages.setSubpageChain(['manage-certificates']);
</if> </if>
<if expr="is_win or is_macosx"> <if expr="is_win or is_macosx">
settings.PrivacyPageBrowserProxyImpl.getInstance(). settings.PrivacyPageBrowserProxyImpl.getInstance().
...@@ -72,18 +48,12 @@ Polymer({ ...@@ -72,18 +48,12 @@ Polymer({
/** @private */ /** @private */
onSiteSettingsTap_: function() { onSiteSettingsTap_: function() {
var pages = /** @type {!SettingsAnimatedPagesElement} */(this.$.pages); this.$.pages.setSubpageChain(['site-settings']);
pages.setSubpageChain(['site-settings']);
}, },
/** @private */ /** @private */
onClearBrowsingDataTap_: function() { onClearBrowsingDataTap_: function() {
this.currentRoute = { this.showClearBrowsingDataDialog_ = true;
page: this.currentRoute.page,
section: this.currentRoute.section,
subpage: this.currentRoute.subpage,
dialog: 'clear-browsing-data',
};
}, },
/** /**
...@@ -91,14 +61,7 @@ Polymer({ ...@@ -91,14 +61,7 @@ Polymer({
* @private * @private
*/ */
onIronOverlayClosed_: function(event) { onIronOverlayClosed_: function(event) {
if (Polymer.dom(event).rootTarget.tagName != 'CR-DIALOG') if (Polymer.dom(event).rootTarget.tagName == 'CR-DIALOG')
return; this.showClearBrowsingDataDialog_ = false;
this.currentRoute = {
page: this.currentRoute.page,
section: this.currentRoute.section,
subpage: this.currentRoute.subpage,
// Drop dialog key.
};
}, },
}); });
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
{ {
'target_name': 'settings_main', 'target_name': 'settings_main',
'dependencies': [ 'dependencies': [
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:promise_resolver',
'../settings_page/compiled_resources2.gyp:main_page_behavior', '../settings_page/compiled_resources2.gyp:main_page_behavior',
'../settings_page/compiled_resources2.gyp:settings_router', '../settings_page/compiled_resources2.gyp:settings_router',
], ],
......
<link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/html/promise_resolver.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="/about_page/about_page.html"> <link rel="import" href="/about_page/about_page.html">
<link rel="import" href="/advanced_page/advanced_page.html"> <link rel="import" href="/advanced_page/advanced_page.html">
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
(function() {
var resolver = new PromiseResolver();
/** /**
* @fileoverview * @fileoverview
* 'settings-main' displays the selected settings page. * 'settings-main' displays the selected settings page.
...@@ -68,25 +64,15 @@ Polymer({ ...@@ -68,25 +64,15 @@ Polymer({
this.showAdvancedPage_ = e.detail; this.showAdvancedPage_ = e.detail;
this.isAdvancedMenuOpen_ = e.detail; this.isAdvancedMenuOpen_ = e.detail;
if (this.showAdvancedPage_) { if (this.showAdvancedPage_) {
doWhenReady( scrollWhenReady(
function() { function() {
var advancedPage = this.$$('settings-advanced-page'); return this.$$('settings-advanced-page');
return !!advancedPage && advancedPage.scrollHeight > 0;
}.bind(this), }.bind(this),
function() { function() {
this.$$('#toggleContainer').scrollIntoView(); return this.$$('#toggleContainer');
}.bind(this)); }.bind(this));
} }
}.bind(this)); }.bind(this));
doWhenReady(
function() {
var basicPage = this.$$('settings-basic-page');
return !!basicPage && basicPage.scrollHeight > 0;
}.bind(this),
function() {
resolver.resolve();
});
}, },
/** /**
...@@ -123,9 +109,3 @@ Polymer({ ...@@ -123,9 +109,3 @@ Polymer({
this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_); this.fire('toggle-advanced-page', !this.isAdvancedMenuOpen_);
}, },
}); });
cr.define('settings.main', function() {
return {rendered: resolver.promise};
});
})();
...@@ -7,20 +7,22 @@ var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)'; ...@@ -7,20 +7,22 @@ var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)';
var EXPAND_DURATION = 350; var EXPAND_DURATION = 350;
/** /**
* Calls |readyTest| repeatedly until it returns true, then calls * Workaround for scrolling an element into view when using Polymer.
* |readyCallback|. * @param {function():Element} containerCallback Return parent of element.
* @param {function():boolean} readyTest * @param {function():Element} elementCallback Return element to scroll to.
* @param {!Function} readyCallback
*/ */
function doWhenReady(readyTest, readyCallback) { function scrollWhenReady(containerCallback, elementCallback) {
// TODO(dschuyler): Determine whether this hack can be removed. // TODO(dschuyler): Determine whether this setTimeout can be removed.
// See also: https://github.com/Polymer/polymer/issues/3629 // See also: https://github.com/Polymer/polymer/issues/3629
var intervalId = setInterval(function() { setTimeout(function pollForScrollHeight() {
if (readyTest()) { var container = containerCallback();
clearInterval(intervalId); if (!container || container.scrollHeight == 0) {
readyCallback(); setTimeout(pollForScrollHeight.bind(this), 10);
return;
} }
}, 10);
elementCallback().scrollIntoView();
}.bind(this));
} }
/** /**
...@@ -367,14 +369,14 @@ var RoutableBehaviorImpl = { ...@@ -367,14 +369,14 @@ var RoutableBehaviorImpl = {
/** @private */ /** @private */
scrollToSection_: function() { scrollToSection_: function() {
doWhenReady( scrollWhenReady(
function() { function() {
return this.scrollHeight > 0; return this;
}.bind(this), }.bind(this),
function() { function() {
// If the current section changes while we are waiting for the page to // If the current section changes while we are waiting for the page to
// be ready, scroll to the newest requested section. // be ready, scroll to the newest requested section.
this.getSection_(this.currentRoute.section).scrollIntoView(); return this.getSection_(this.currentRoute.section);
}.bind(this)); }.bind(this));
}, },
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
* page: string, * page: string,
* section: string, * section: string,
* subpage: !Array<string>, * subpage: !Array<string>,
* dialog: (string|undefined),
* }} * }}
*/ */
var SettingsRoute; var SettingsRoute;
...@@ -59,7 +58,6 @@ Polymer({ ...@@ -59,7 +58,6 @@ Polymer({
page: route.page, page: route.page,
section: route.section, section: route.section,
subpage: route.subpage, subpage: route.subpage,
dialog: route.dialog,
}; };
} }
} }
...@@ -427,8 +425,7 @@ Polymer({ ...@@ -427,8 +425,7 @@ Polymer({
url: '/clearBrowserData', url: '/clearBrowserData',
page: 'advanced', page: 'advanced',
section: 'privacy', section: 'privacy',
subpage: [], subpage: ['clear-browsing-data'],
dialog: 'clear-browsing-data',
}, },
<if expr="chromeos"> <if expr="chromeos">
{ {
...@@ -587,13 +584,12 @@ Polymer({ ...@@ -587,13 +584,12 @@ Polymer({
currentRouteChanged_: function(newRoute, oldRoute) { currentRouteChanged_: function(newRoute, oldRoute) {
for (var i = 0; i < this.routes_.length; ++i) { for (var i = 0; i < this.routes_.length; ++i) {
var route = this.routes_[i]; var route = this.routes_[i];
if (route.page == newRoute.page && if (route.page == newRoute.page && route.section == newRoute.section &&
route.section == newRoute.section &&
route.dialog == newRoute.dialog &&
route.subpage.length == newRoute.subpage.length && route.subpage.length == newRoute.subpage.length &&
newRoute.subpage.every(function(value, index) { newRoute.subpage.every(function(value, index) {
return value == route.subpage[index]; return value == route.subpage[index];
})) { })) {
// Update the property containing the titles for the current route. // Update the property containing the titles for the current route.
this.currentRouteTitles = { this.currentRouteTitles = {
pageTitle: loadTimeData.getString(route.page + 'PageTitle'), pageTitle: loadTimeData.getString(route.page + 'PageTitle'),
...@@ -609,7 +605,6 @@ Polymer({ ...@@ -609,7 +605,6 @@ Polymer({
page: newRoute.page, page: newRoute.page,
section: newRoute.section, section: newRoute.section,
subpage: newRoute.subpage, subpage: newRoute.subpage,
dialog: newRoute.dialog,
}; };
// Push the current route to the history state, so when the user // Push the current route to the history state, so when the user
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment