OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { | 55 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { |
56 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, | 56 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, |
57 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, | 57 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, |
58 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, | 58 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, |
59 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, | 59 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, |
60 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, | 60 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, |
61 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, | 61 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, |
62 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, | 62 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, |
63 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, | 63 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, |
| 64 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, |
64 }; | 65 }; |
| 66 COMPILE_ASSERT(arraysize(kContentSettingsTypeGroupNames) == |
| 67 CONTENT_SETTINGS_NUM_TYPES, |
| 68 MISSING_CONTENT_SETTINGS_TYPE); |
65 | 69 |
66 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) { | 70 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) { |
67 for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { | 71 for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { |
68 if (name == kContentSettingsTypeGroupNames[i].name) | 72 if (name == kContentSettingsTypeGroupNames[i].name) |
69 return kContentSettingsTypeGroupNames[i].type; | 73 return kContentSettingsTypeGroupNames[i].type; |
70 } | 74 } |
71 | 75 |
72 NOTREACHED() << name << " is not a recognized content settings type."; | 76 NOTREACHED() << name << " is not a recognized content settings type."; |
73 return CONTENT_SETTINGS_TYPE_DEFAULT; | 77 return CONTENT_SETTINGS_TYPE_DEFAULT; |
74 } | 78 } |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); | 762 return Profile::FromWebUI(web_ui_)->GetProtocolHandlerRegistry(); |
759 } | 763 } |
760 | 764 |
761 HostContentSettingsMap* | 765 HostContentSettingsMap* |
762 ContentSettingsHandler::GetOTRContentSettingsMap() { | 766 ContentSettingsHandler::GetOTRContentSettingsMap() { |
763 Profile* profile = Profile::FromWebUI(web_ui_); | 767 Profile* profile = Profile::FromWebUI(web_ui_); |
764 if (profile->HasOffTheRecordProfile()) | 768 if (profile->HasOffTheRecordProfile()) |
765 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); | 769 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); |
766 return NULL; | 770 return NULL; |
767 } | 771 } |
OLD | NEW |