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

Unified Diff: chrome/browser/permissions/permission_util.cc

Issue 2640033006: Convert AutoBlocker static class to KeyedService. (Closed)
Patch Set: Remove static methods, nits Created 3 years, 11 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/permissions/permission_util.cc
diff --git a/chrome/browser/permissions/permission_util.cc b/chrome/browser/permissions/permission_util.cc
index 0643a0f7fc9c37a247e5ce3d82ab37e6f0a642f3..ef8ef417001c2e0b68f4627ab0cfe5dada2e1d71 100644
--- a/chrome/browser/permissions/permission_util.cc
+++ b/chrome/browser/permissions/permission_util.cc
@@ -27,27 +27,27 @@ std::string PermissionUtil::GetPermissionString(
content::PermissionType permission) {
switch (permission) {
case content::PermissionType::GEOLOCATION:
- return "Geolocation";
+ return kGeolocationPermissionName;
case content::PermissionType::NOTIFICATIONS:
- return "Notifications";
+ return kNotificationPermissionName;
case content::PermissionType::MIDI_SYSEX:
- return "MidiSysEx";
+ return kMidiSysExnPermissionName;
case content::PermissionType::PUSH_MESSAGING:
- return "PushMessaging";
+ return kPushMessagingPermissionName;
case content::PermissionType::DURABLE_STORAGE:
- return "DurableStorage";
+ return kDurableStoragePermissionName;
case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
- return "ProtectedMediaIdentifier";
+ return kProtectedMediaPermissionName;
case content::PermissionType::AUDIO_CAPTURE:
- return "AudioCapture";
+ return kAudioCapturePermissionName;
case content::PermissionType::VIDEO_CAPTURE:
- return "VideoCapture";
+ return kVideoCapturePermissionName;
case content::PermissionType::MIDI:
- return "Midi";
+ return kMidiPermissionName;
case content::PermissionType::BACKGROUND_SYNC:
- return "BackgroundSync";
+ return kBackgroundSyncPermissionName;
case content::PermissionType::FLASH:
- return "Flash";
+ return kFlashPermissionName;
case content::PermissionType::NUM:
break;
}
@@ -55,6 +55,34 @@ std::string PermissionUtil::GetPermissionString(
return std::string();
}
+content::PermissionType PermissionUtil::ConvertSafeBrowsingNameToPermissionType(
+ const std::string& sb_name) {
+ if (sb_name == "GEOLOCATION")
raymes 2017/01/24 05:15:17 nit: please make a note that the name is a stringi
meredithl 2017/01/24 23:20:21 I've now changed this method around so there is no
+ return content::PermissionType::GEOLOCATION;
+ if (sb_name == "NOTIFICATIONS")
+ return content::PermissionType::NOTIFICATIONS;
+ if (sb_name == "MIDI_SYSEX")
+ return content::PermissionType::MIDI_SYSEX;
+ if (sb_name == "PUSH_MESSAGING")
+ return content::PermissionType::PUSH_MESSAGING;
+ if (sb_name == "DURABLE_STORAGE")
+ return content::PermissionType::DURABLE_STORAGE;
+ if (sb_name == "PROTECTED_MEDIA_IDENTIFIER")
+ return content::PermissionType::PROTECTED_MEDIA_IDENTIFIER;
+ if (sb_name == "AUDIO_CAPTURE")
+ return content::PermissionType::AUDIO_CAPTURE;
+ if (sb_name == "VIDEO_CAPTURE")
+ return content::PermissionType::MIDI;
+ if (sb_name == "MIDI")
+ return content::PermissionType::MIDI;
+ if (sb_name == "BACKGROUND_SYNC")
+ return content::PermissionType::BACKGROUND_SYNC;
+ if (sb_name == "FLASH")
+ return content::PermissionType::FLASH;
+ NOTREACHED();
+ return content::PermissionType::NUM;
+}
+
PermissionRequestType PermissionUtil::GetRequestType(
content::PermissionType type) {
switch (type) {
« chrome/browser/permissions/permission_util.h ('K') | « chrome/browser/permissions/permission_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698