Index: chrome/browser/ui/content_settings/content_setting_bubble_model.cc |
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc |
index 0a03d05ad5f14ab38aa8f247ab791d484620f641..0aabfaa67a8c49b8e654f07b6d4ba94ce96419d3 100644 |
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc |
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc |
@@ -5,7 +5,9 @@ |
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
#include "base/command_line.h" |
+#include "base/lazy_instance.h" |
#include "base/prefs/pref_service.h" |
+#include "base/stl_util.h" |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/content_settings/chrome_content_settings_utils.h" |
@@ -55,6 +57,24 @@ namespace { |
const int kAllowButtonIndex = 0; |
+// static |
+const ContentSettingsType kSupportedBubbleTypes[] = { |
+ CONTENT_SETTINGS_TYPE_COOKIES, |
+ CONTENT_SETTINGS_TYPE_IMAGES, |
+ CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
+ CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
+ CONTENT_SETTINGS_TYPE_PLUGINS, |
+ CONTENT_SETTINGS_TYPE_POPUPS, |
+ CONTENT_SETTINGS_TYPE_GEOLOCATION, |
+ CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, |
+ CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, |
+ CONTENT_SETTINGS_TYPE_MEDIASTREAM, |
+ CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
+ CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
+ CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, |
+ CONTENT_SETTINGS_TYPE_MIDI_SYSEX, |
+}; |
+ |
// These states must match the order of appearance of the radio buttons |
// in the XIB file for the Mac port. |
enum RPHState { |
@@ -1263,6 +1283,20 @@ void ContentSettingMidiSysExBubbleModel::OnCustomLinkClicked() { |
} |
} |
+base::LazyInstance<std::set<ContentSettingsType>> g_supported_bubble_types = |
tapted
2015/09/03 06:36:38
either:
anonymous namespace + base::LazyInstance<
raymes
2015/09/07 04:29:27
Ah you're right - I had this before but changed it
|
+ LAZY_INSTANCE_INITIALIZER; |
+ |
+// static |
+const std::set<ContentSettingsType>& |
+ContentSettingBubbleModel::GetSupportedBubbleTypes() { |
+ std::set<ContentSettingsType>& types = g_supported_bubble_types.Get(); |
+ if (types.empty()) { |
+ types.insert(kSupportedBubbleTypes, |
+ kSupportedBubbleTypes + arraysize(kSupportedBubbleTypes)); |
+ } |
+ return types; |
+} |
+ |
// static |
ContentSettingBubbleModel* |
ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
@@ -1270,6 +1304,7 @@ ContentSettingBubbleModel* |
WebContents* web_contents, |
Profile* profile, |
ContentSettingsType content_type) { |
+ DCHECK(ContainsKey(GetSupportedBubbleTypes(), content_type)); |
tapted
2015/09/03 06:36:38
I've never really understood ContainsKey.... if yo
raymes
2015/09/07 04:29:27
I agree with you - I used to do that but I've had
|
if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) { |
return new ContentSettingCookiesBubbleModel(delegate, web_contents, |
profile); |