summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webui/options/content_settings_handler.cc
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 19:56:14 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 19:56:14 +0000
commitf72298c8e0ce1427e8ed682ca5dad0573d6c2763 (patch)
tree842b5af9151d68cb51acf5c113d09e43fca703a8 /chrome/browser/webui/options/content_settings_handler.cc
parent6d81b488e8cc5e10eaeca0a4ee4819dc3f469a24 (diff)
downloadchromium_src-f72298c8e0ce1427e8ed682ca5dad0573d6c2763.zip
chromium_src-f72298c8e0ce1427e8ed682ca5dad0573d6c2763.tar.gz
chromium_src-f72298c8e0ce1427e8ed682ca5dad0573d6c2763.tar.bz2
Add an icon to the omnibox when a page is prerendered.
This will only show up for users who have prerendering enabled (mainly via about:flags) This CL does not include the logic for displaying whether prerender failed on the referring page. BUG=73065 TEST=Start Chrome with prerendering enabled, go to a page with a <link rel=prefetch> element, navigate to the referred page, and see icon appear. Review URL: http://codereview.chromium.org/6529031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webui/options/content_settings_handler.cc')
-rw-r--r--chrome/browser/webui/options/content_settings_handler.cc60
1 files changed, 27 insertions, 33 deletions
diff --git a/chrome/browser/webui/options/content_settings_handler.cc b/chrome/browser/webui/options/content_settings_handler.cc
index 88e7c3a..9be48e1 100644
--- a/chrome/browser/webui/options/content_settings_handler.cc
+++ b/chrome/browser/webui/options/content_settings_handler.cc
@@ -33,21 +33,29 @@ const char* kSetting = "setting";
const char* kOrigin = "origin";
const char* kEmbeddingOrigin = "embeddingOrigin";
+const char* const kContentSettingsTypeGroupNames[] = {
+ "cookies",
+ "images",
+ "javascript",
+ "plugins",
+ "popups",
+ "location",
+ "notifications",
+ "prerender",
+};
+COMPILE_ASSERT(arraysize(kContentSettingsTypeGroupNames) ==
+ CONTENT_SETTINGS_NUM_TYPES,
+ invalid_content_settings_type_group_names_size);
+
+
ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) {
- if (name == "cookies")
- return CONTENT_SETTINGS_TYPE_COOKIES;
- if (name == "images")
- return CONTENT_SETTINGS_TYPE_IMAGES;
- if (name == "javascript")
- return CONTENT_SETTINGS_TYPE_JAVASCRIPT;
- if (name == "plugins")
- return CONTENT_SETTINGS_TYPE_PLUGINS;
- if (name == "popups")
- return CONTENT_SETTINGS_TYPE_POPUPS;
- if (name == "location")
- return CONTENT_SETTINGS_TYPE_GEOLOCATION;
- if (name == "notifications")
- return CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
+
+ for (int content_settings_type = CONTENT_SETTINGS_TYPE_COOKIES;
+ content_settings_type < CONTENT_SETTINGS_NUM_TYPES;
+ ++content_settings_type) {
+ if (name == kContentSettingsTypeGroupNames[content_settings_type])
+ return static_cast<ContentSettingsType>(content_settings_type);
+ }
NOTREACHED() << name << " is not a recognized content settings type.";
return CONTENT_SETTINGS_TYPE_DEFAULT;
@@ -693,26 +701,12 @@ void ContentSettingsHandler::CheckExceptionPatternValidity(
// static
std::string ContentSettingsHandler::ContentSettingsTypeToGroupName(
ContentSettingsType type) {
- switch (type) {
- case CONTENT_SETTINGS_TYPE_COOKIES:
- return "cookies";
- case CONTENT_SETTINGS_TYPE_IMAGES:
- return "images";
- case CONTENT_SETTINGS_TYPE_JAVASCRIPT:
- return "javascript";
- case CONTENT_SETTINGS_TYPE_PLUGINS:
- return "plugins";
- case CONTENT_SETTINGS_TYPE_POPUPS:
- return "popups";
- case CONTENT_SETTINGS_TYPE_GEOLOCATION:
- return "location";
- case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
- return "notifications";
-
- default:
- NOTREACHED();
- return "";
+ if (type < CONTENT_SETTINGS_TYPE_COOKIES ||
+ type >= CONTENT_SETTINGS_NUM_TYPES) {
+ NOTREACHED();
+ return "";
}
+ return kContentSettingsTypeGroupNames[type];
}
HostContentSettingsMap* ContentSettingsHandler::GetContentSettingsMap() {