Chromium Code Reviews| Index: chrome/browser/ui/webui/site_settings_helper.h |
| diff --git a/chrome/browser/ui/webui/site_settings_helper.h b/chrome/browser/ui/webui/site_settings_helper.h |
| index 9ab9f195eaf5602a57f715c69dc012bf2acbb769..00b82b51bbef2742aab9f3c055f741817e4f8e65 100644 |
| --- a/chrome/browser/ui/webui/site_settings_helper.h |
| +++ b/chrome/browser/ui/webui/site_settings_helper.h |
| @@ -14,7 +14,9 @@ |
| #include "components/content_settings/core/common/content_settings_types.h" |
| #include "content/public/browser/web_ui.h" |
| +class ChooserContextBase; |
| class HostContentSettingsMap; |
| +class Profile; |
| namespace base { |
| class DictionaryValue; |
| @@ -39,6 +41,9 @@ extern const char kSource[]; |
| extern const char kEmbeddingOrigin[]; |
| extern const char kPreferencesSource[]; |
| +// Group types. |
| +extern const char kGroupTypeUsb[]; |
| + |
| // Returns whether a group name has been registered for the given type. |
| bool HasRegisteredGroupName(ContentSettingsType type); |
| @@ -62,6 +67,62 @@ void GetPolicyAllowedUrls( |
| std::vector<std::unique_ptr<base::DictionaryValue>>* exceptions, |
| content::WebUI* web_ui); |
| +// This struct facilitates lookup of a chooser context factory function by name |
| +// for a given content settings type and is declared early so that it can used |
| +// by functions below. |
| +struct ChooserTypeNameEntry { |
| + ContentSettingsType type; |
| + ChooserContextBase* (*get_context)(Profile*); |
| + const char* name; |
| + const char* ui_name_key; |
| +}; |
| + |
| +ChooserContextBase* GetUsbChooserContext(Profile* profile); |
| + |
| +struct ContentSettingsTypeNameEntry { |
| + ContentSettingsType type; |
| + const char* name; |
| +}; |
| + |
| +const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { |
| + {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, |
| + {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, |
| + {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, |
| + {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, |
| + {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, |
| + {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, |
| + {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, |
| + {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, |
| + {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, |
| + {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, |
| + {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, |
| + {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, |
| + {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, |
| + {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, |
| + {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, |
| + {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, |
| + {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, |
| +#if defined(OS_CHROMEOS) |
| + {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, |
| +#endif |
| + {CONTENT_SETTINGS_TYPE_KEYGEN, "keygen"}, |
| + {CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC, "background-sync"}, |
| +}; |
| + |
| +const ChooserTypeNameEntry kChooserTypeGroupNames[] = { |
| + {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext, |
| + kGroupTypeUsb, "name"}, |
| +}; |
| + |
| +const ChooserTypeNameEntry* ChooserTypeFromGroupName(const std::string& name); |
| + |
| +// Fills in |exceptions| with Values for the given |type| from |map|. |
|
dschuyler
2016/08/12 20:58:49
nit: should this say |chooser_type|?
and the shoul
Finnur
2016/08/15 11:54:33
Done.
|
| +void GetChooserExceptionsFromProfile( |
| + Profile* profile, |
| + bool incognito, |
| + const ChooserTypeNameEntry& chooser_type, |
| + base::ListValue* exceptions); |
| + |
| } // namespace site_settings |
| #endif // CHROME_BROWSER_UI_WEBUI_SITE_SETTINGS_HELPER_H_ |