| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/permissions/permission_util.h" | 5 #include "chrome/browser/permissions/permission_util.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool PermissionUtil::GetPermissionType(ContentSettingsType type, | 108 bool PermissionUtil::GetPermissionType(ContentSettingsType type, |
| 109 PermissionType* out) { | 109 PermissionType* out) { |
| 110 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { | 110 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { |
| 111 *out = PermissionType::GEOLOCATION; | 111 *out = PermissionType::GEOLOCATION; |
| 112 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { | 112 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { |
| 113 *out = PermissionType::NOTIFICATIONS; | 113 *out = PermissionType::NOTIFICATIONS; |
| 114 } else if (type == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) { | 114 } else if (type == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) { |
| 115 *out = PermissionType::PUSH_MESSAGING; | 115 *out = PermissionType::PUSH_MESSAGING; |
| 116 } else if (type == CONTENT_SETTINGS_TYPE_MIDI) { |
| 117 *out = PermissionType::MIDI; |
| 116 } else if (type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { | 118 } else if (type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { |
| 117 *out = PermissionType::MIDI_SYSEX; | 119 *out = PermissionType::MIDI_SYSEX; |
| 118 } else if (type == CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) { | 120 } else if (type == CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) { |
| 119 *out = PermissionType::DURABLE_STORAGE; | 121 *out = PermissionType::DURABLE_STORAGE; |
| 120 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { | 122 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { |
| 121 *out = PermissionType::VIDEO_CAPTURE; | 123 *out = PermissionType::VIDEO_CAPTURE; |
| 122 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { | 124 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { |
| 123 *out = PermissionType::AUDIO_CAPTURE; | 125 *out = PermissionType::AUDIO_CAPTURE; |
| 124 } else if (type == CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC) { | 126 } else if (type == CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC) { |
| 125 *out = PermissionType::BACKGROUND_SYNC; | 127 *out = PermissionType::BACKGROUND_SYNC; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 return; | 185 return; |
| 184 HostContentSettingsMap* settings_map = | 186 HostContentSettingsMap* settings_map = |
| 185 HostContentSettingsMapFactory::GetForProfile(profile_); | 187 HostContentSettingsMapFactory::GetForProfile(profile_); |
| 186 ContentSetting final_content_setting = settings_map->GetContentSetting( | 188 ContentSetting final_content_setting = settings_map->GetContentSetting( |
| 187 primary_url_, secondary_url_, content_type_, std::string()); | 189 primary_url_, secondary_url_, content_type_, std::string()); |
| 188 if (final_content_setting != CONTENT_SETTING_ALLOW) { | 190 if (final_content_setting != CONTENT_SETTING_ALLOW) { |
| 189 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_, | 191 PermissionUmaUtil::PermissionRevoked(content_type_, source_ui_, |
| 190 primary_url_, profile_); | 192 primary_url_, profile_); |
| 191 } | 193 } |
| 192 } | 194 } |
| OLD | NEW |