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) { |