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

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

Issue 2675483002: Replace PermissionType in chrome/ with ContentSettingsType (Closed)
Patch Set: rebase + include content_settings_types.h more Created 3 years, 10 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
« no previous file with comments | « chrome/browser/permissions/permission_util.h ('k') | chrome/browser/plugins/flash_download_interception.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/permissions/permission_util.cc
diff --git a/chrome/browser/permissions/permission_util.cc b/chrome/browser/permissions/permission_util.cc
index 2e8d5075375871d61b0521cffc961bd89c9bcced..955b2f64cc96c63ed857d6b35d0f1e6ef2316256 100644
--- a/chrome/browser/permissions/permission_util.cc
+++ b/chrome/browser/permissions/permission_util.cc
@@ -15,92 +15,92 @@
using content::PermissionType;
-std::size_t PermissionTypeHash::operator()(
- const content::PermissionType& type) const {
- return static_cast<size_t>(type);
+std::string PermissionUtil::GetPermissionString(
+ ContentSettingsType content_type) {
+ PermissionType permission_type;
+ bool success = PermissionUtil::GetPermissionType(
+ content_type, &permission_type);
+ DCHECK(success);
+ return GetPermissionString(permission_type);
}
// The returned strings must match the RAPPOR metrics in rappor.xml,
// and any Field Trial configs for the Permissions kill switch e.g.
// Permissions.Action.Geolocation etc..
-std::string PermissionUtil::GetPermissionString(
- content::PermissionType permission) {
+std::string PermissionUtil::GetPermissionString(PermissionType permission) {
switch (permission) {
- case content::PermissionType::GEOLOCATION:
+ case PermissionType::GEOLOCATION:
return "Geolocation";
- case content::PermissionType::NOTIFICATIONS:
+ case PermissionType::NOTIFICATIONS:
return "Notifications";
- case content::PermissionType::MIDI_SYSEX:
+ case PermissionType::MIDI_SYSEX:
return "MidiSysEx";
- case content::PermissionType::PUSH_MESSAGING:
+ case PermissionType::PUSH_MESSAGING:
return "PushMessaging";
- case content::PermissionType::DURABLE_STORAGE:
+ case PermissionType::DURABLE_STORAGE:
return "DurableStorage";
- case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
+ case PermissionType::PROTECTED_MEDIA_IDENTIFIER:
return "ProtectedMediaIdentifier";
- case content::PermissionType::AUDIO_CAPTURE:
+ case PermissionType::AUDIO_CAPTURE:
return "AudioCapture";
- case content::PermissionType::VIDEO_CAPTURE:
+ case PermissionType::VIDEO_CAPTURE:
return "VideoCapture";
- case content::PermissionType::MIDI:
+ case PermissionType::MIDI:
return "Midi";
- case content::PermissionType::BACKGROUND_SYNC:
+ case PermissionType::BACKGROUND_SYNC:
return "BackgroundSync";
- case content::PermissionType::FLASH:
+ case PermissionType::FLASH:
return "Flash";
- case content::PermissionType::NUM:
+ default:
break;
}
NOTREACHED();
return std::string();
}
-std::string PermissionUtil::ConvertPermissionTypeToSafeBrowsingName(
- const content::PermissionType& permission_type) {
+std::string PermissionUtil::ConvertContentSettingsTypeToSafeBrowsingName(
+ ContentSettingsType permission_type) {
switch (permission_type) {
- case content::PermissionType::GEOLOCATION:
+ case CONTENT_SETTINGS_TYPE_GEOLOCATION:
return "GEOLOCATION";
- case content::PermissionType::NOTIFICATIONS:
+ case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
return "NOTIFICATIONS";
- case content::PermissionType::MIDI_SYSEX:
+ case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
return "MIDI_SYSEX";
- case content::PermissionType::PUSH_MESSAGING:
+ case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
return "PUSH_MESSAGING";
- case content::PermissionType::DURABLE_STORAGE:
+ case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE:
return "DURABLE_STORAGE";
- case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
+ case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
return "PROTECTED_MEDIA_IDENTIFIER";
- case content::PermissionType::AUDIO_CAPTURE:
+ case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
return "AUDIO_CAPTURE";
- case content::PermissionType::VIDEO_CAPTURE:
+ case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
return "VIDEO_CAPTURE";
- case content::PermissionType::MIDI:
- return "MIDI";
- case content::PermissionType::BACKGROUND_SYNC:
+ case CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC:
return "BACKGROUND_SYNC";
- case content::PermissionType::FLASH:
+ case CONTENT_SETTINGS_TYPE_PLUGINS:
return "FLASH";
- case content::PermissionType::NUM:
+ default:
break;
}
NOTREACHED();
return std::string();
}
-PermissionRequestType PermissionUtil::GetRequestType(
- content::PermissionType type) {
+PermissionRequestType PermissionUtil::GetRequestType(ContentSettingsType type) {
switch (type) {
- case content::PermissionType::GEOLOCATION:
+ case CONTENT_SETTINGS_TYPE_GEOLOCATION:
return PermissionRequestType::PERMISSION_GEOLOCATION;
- case content::PermissionType::NOTIFICATIONS:
+ case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
return PermissionRequestType::PERMISSION_NOTIFICATIONS;
- case content::PermissionType::MIDI_SYSEX:
+ case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
return PermissionRequestType::PERMISSION_MIDI_SYSEX;
- case content::PermissionType::PUSH_MESSAGING:
+ case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
return PermissionRequestType::PERMISSION_PUSH_MESSAGING;
- case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
+ case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER;
- case content::PermissionType::FLASH:
+ case CONTENT_SETTINGS_TYPE_PLUGINS:
return PermissionRequestType::PERMISSION_FLASH;
default:
NOTREACHED();
@@ -119,6 +119,8 @@ bool PermissionUtil::GetPermissionType(ContentSettingsType type,
*out = PermissionType::GEOLOCATION;
} else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
*out = PermissionType::NOTIFICATIONS;
+ } else if (type == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) {
+ *out = PermissionType::PUSH_MESSAGING;
} else if (type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) {
*out = PermissionType::MIDI_SYSEX;
} else if (type == CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) {
@@ -129,6 +131,8 @@ bool PermissionUtil::GetPermissionType(ContentSettingsType type,
*out = PermissionType::AUDIO_CAPTURE;
} else if (type == CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC) {
*out = PermissionType::BACKGROUND_SYNC;
+ } else if (type == CONTENT_SETTINGS_TYPE_PLUGINS) {
+ *out = PermissionType::FLASH;
#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
} else if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) {
*out = PermissionType::PROTECTED_MEDIA_IDENTIFIER;
@@ -192,7 +196,7 @@ PermissionUtil::ScopedRevocationReporter::~ScopedRevocationReporter() {
if (final_content_setting != CONTENT_SETTING_ALLOW) {
PermissionType permission_type;
if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) {
- PermissionUmaUtil::PermissionRevoked(permission_type, source_ui_,
+ PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_,
primary_url_, profile_);
}
}
« no previous file with comments | « chrome/browser/permissions/permission_util.h ('k') | chrome/browser/plugins/flash_download_interception.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698