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

Unified Diff: chrome/browser/ui/content_settings/content_setting_bubble_model.cc

Issue 1312053006: Remove CONTENT_SETTINGS_NUM_TYPES (part 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@website-settings-registry-4
Patch Set: Created 5 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
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..ab1da3c582ca265d3bd2e35355888e272e578d11 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/macros.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,22 @@ 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_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 {
@@ -1264,12 +1282,23 @@ void ContentSettingMidiSysExBubbleModel::OnCustomLinkClicked() {
}
// static
+const std::set<ContentSettingsType>&
+ContentSettingBubbleModel::GetSupportedBubbleTypes() {
+ CR_DEFINE_STATIC_LOCAL(
+ const std::set<ContentSettingsType>, supported_bubble_types,
+ (kSupportedBubbleTypes,
+ kSupportedBubbleTypes + arraysize(kSupportedBubbleTypes)));
+ return supported_bubble_types;
+}
+
+// static
ContentSettingBubbleModel*
ContentSettingBubbleModel::CreateContentSettingBubbleModel(
Delegate* delegate,
WebContents* web_contents,
Profile* profile,
ContentSettingsType content_type) {
+ DCHECK(ContainsKey(GetSupportedBubbleTypes(), content_type));
if (content_type == CONTENT_SETTINGS_TYPE_COOKIES) {
return new ContentSettingCookiesBubbleModel(delegate, web_contents,
profile);

Powered by Google App Engine
This is Rietveld 408576698