| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return "BackgroundSync"; | 48 return "BackgroundSync"; |
| 49 case content::PermissionType::FLASH: | 49 case content::PermissionType::FLASH: |
| 50 return "Flash"; | 50 return "Flash"; |
| 51 case content::PermissionType::NUM: | 51 case content::PermissionType::NUM: |
| 52 break; | 52 break; |
| 53 } | 53 } |
| 54 NOTREACHED(); | 54 NOTREACHED(); |
| 55 return std::string(); | 55 return std::string(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 std::string PermissionUtil::ConvertPermissionTypeToSafeBrowsingName( |
| 59 const content::PermissionType& permission_type) { |
| 60 switch (permission_type) { |
| 61 case content::PermissionType::GEOLOCATION: |
| 62 return "GEOLOCATION"; |
| 63 case content::PermissionType::NOTIFICATIONS: |
| 64 return "NOTIFICATIONS"; |
| 65 case content::PermissionType::MIDI_SYSEX: |
| 66 return "MIDI_SYSEX"; |
| 67 case content::PermissionType::PUSH_MESSAGING: |
| 68 return "PUSH_MESSAGING"; |
| 69 case content::PermissionType::DURABLE_STORAGE: |
| 70 return "DURABLE_STORAGE"; |
| 71 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 72 return "PROTECTED_MEDIA_IDENTIFIER"; |
| 73 case content::PermissionType::AUDIO_CAPTURE: |
| 74 return "AUDIO_CAPTURE"; |
| 75 case content::PermissionType::VIDEO_CAPTURE: |
| 76 return "VIDEO_CAPTURE"; |
| 77 case content::PermissionType::MIDI: |
| 78 return "MIDI"; |
| 79 case content::PermissionType::BACKGROUND_SYNC: |
| 80 return "BACKGROUND_SYNC"; |
| 81 case content::PermissionType::FLASH: |
| 82 return "FLASH"; |
| 83 case content::PermissionType::NUM: |
| 84 break; |
| 85 } |
| 86 NOTREACHED(); |
| 87 return std::string(); |
| 88 } |
| 89 |
| 58 PermissionRequestType PermissionUtil::GetRequestType( | 90 PermissionRequestType PermissionUtil::GetRequestType( |
| 59 content::PermissionType type) { | 91 content::PermissionType type) { |
| 60 switch (type) { | 92 switch (type) { |
| 61 case content::PermissionType::GEOLOCATION: | 93 case content::PermissionType::GEOLOCATION: |
| 62 return PermissionRequestType::PERMISSION_GEOLOCATION; | 94 return PermissionRequestType::PERMISSION_GEOLOCATION; |
| 63 case content::PermissionType::NOTIFICATIONS: | 95 case content::PermissionType::NOTIFICATIONS: |
| 64 return PermissionRequestType::PERMISSION_NOTIFICATIONS; | 96 return PermissionRequestType::PERMISSION_NOTIFICATIONS; |
| 65 case content::PermissionType::MIDI_SYSEX: | 97 case content::PermissionType::MIDI_SYSEX: |
| 66 return PermissionRequestType::PERMISSION_MIDI_SYSEX; | 98 return PermissionRequestType::PERMISSION_MIDI_SYSEX; |
| 67 case content::PermissionType::PUSH_MESSAGING: | 99 case content::PermissionType::PUSH_MESSAGING: |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 ContentSetting final_content_setting = settings_map->GetContentSetting( | 190 ContentSetting final_content_setting = settings_map->GetContentSetting( |
| 159 primary_url_, secondary_url_, content_type_, std::string()); | 191 primary_url_, secondary_url_, content_type_, std::string()); |
| 160 if (final_content_setting != CONTENT_SETTING_ALLOW) { | 192 if (final_content_setting != CONTENT_SETTING_ALLOW) { |
| 161 PermissionType permission_type; | 193 PermissionType permission_type; |
| 162 if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) { | 194 if (PermissionUtil::GetPermissionType(content_type_, &permission_type)) { |
| 163 PermissionUmaUtil::PermissionRevoked(permission_type, source_ui_, | 195 PermissionUmaUtil::PermissionRevoked(permission_type, source_ui_, |
| 164 primary_url_, profile_); | 196 primary_url_, profile_); |
| 165 } | 197 } |
| 166 } | 198 } |
| 167 } | 199 } |
| OLD | NEW |