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

Unified Diff: chrome/browser/ui/webui/site_settings_helper.h

Issue 2237823003: Site Settings Desktop: Implement USB devices section. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 4 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/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..413207c66b254e5e2ed979eed6a5ad169059dbbb 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 |chooser_type| from map.
+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_
« no previous file with comments | « chrome/browser/ui/webui/settings/site_settings_handler.cc ('k') | chrome/browser/ui/webui/site_settings_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698