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

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

Issue 547753004: Allow the content setting or resource type to be passed into the Website Settings page by a hash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/website_settings.js
diff --git a/chrome/browser/resources/options/website_settings.js b/chrome/browser/resources/options/website_settings.js
index bcc1aa437aaaedae4f6022357f26d54d67ff3795..f1262f6392a4f1c3cffded8ce9e84a9700b2031b 100644
--- a/chrome/browser/resources/options/website_settings.js
+++ b/chrome/browser/resources/options/website_settings.js
@@ -42,12 +42,7 @@ cr.define('options', function() {
$('resourceType').onchange = function() {
var target = event.target;
assert(target.tagName == 'SELECT');
- if (target.value == 'storage')
- chrome.send('updateLocalStorage');
- else if (target.value == 'battery')
- chrome.send('updateBatteryUsage');
- else
- chrome.send('updateOrigins', [target.value]);
+ WebsiteSettingsManager.getInstance().updatePage_(target.value);
};
var searchBox = $('website-settings-search-box');
@@ -60,7 +55,26 @@ cr.define('options', function() {
};
this.createOriginsList_();
- chrome.send('updateOrigins', ['geolocation']);
+ },
+
+ /**
+ * Called after the page has been shown. Show the content settings or
+ * resource auditing for the location's hash.
+ */
+ didShowPage: function() {
+ var hash = location.hash;
+ if (hash)
+ hash = hash.slice(1);
+ else
+ hash = 'geolocation';
+ this.updatePage_(hash);
+
+ var selectResource = $('resourceType');
+ for (var i = 0; i < selectResource.options.length; i++) {
Bernhard Bauer 2014/09/09 09:05:22 I think there's an easier way to do this... can yo
Daniel Nishi 2014/09/09 15:14:55 Huh. I thought I tested that and it didn't work, b
+ var value = selectResource.options[i].value;
+ if (value == hash)
+ selectResource.selectedIndex = i;
+ }
},
/**
@@ -120,6 +134,20 @@ cr.define('options', function() {
this.queryDelayTimerId_ = window.setTimeout(this.searchOrigins.bind(this),
160);
},
+
+ /**
+ * Updates the page with the given content setting or resource name's
+ * information.
+ * @param {string} typeName The name of the content setting or resource.
+ */
+ updatePage_: function(typeName) {
+ if (typeName == 'storage')
+ chrome.send('updateLocalStorage');
+ else if (typeName == 'battery')
+ chrome.send('updateBatteryUsage');
+ else
+ chrome.send('updateOrigins', [typeName]);
+ }
};
WebsiteSettingsManager.populateOrigins = function(originDict) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698