| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 9 #include "chrome/browser/permissions/permission_uma_util.h" | 9 #include "chrome/browser/permissions/permission_uma_util.h" |
| 10 #include "components/content_settings/core/browser/host_content_settings_map.h" | 10 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool PermissionUtil::GetPermissionType(ContentSettingsType type, | 53 bool PermissionUtil::GetPermissionType(ContentSettingsType type, |
| 54 PermissionType* out) { | 54 PermissionType* out) { |
| 55 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { | 55 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { |
| 56 *out = PermissionType::GEOLOCATION; | 56 *out = PermissionType::GEOLOCATION; |
| 57 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { | 57 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { |
| 58 *out = PermissionType::NOTIFICATIONS; | 58 *out = PermissionType::NOTIFICATIONS; |
| 59 } else if (type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { | 59 } else if (type == CONTENT_SETTINGS_TYPE_MIDI_SYSEX) { |
| 60 *out = PermissionType::MIDI_SYSEX; | 60 *out = PermissionType::MIDI_SYSEX; |
| 61 } else if (type == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) { | |
| 62 *out = PermissionType::PUSH_MESSAGING; | |
| 63 } else if (type == CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) { | 61 } else if (type == CONTENT_SETTINGS_TYPE_DURABLE_STORAGE) { |
| 64 *out = PermissionType::DURABLE_STORAGE; | 62 *out = PermissionType::DURABLE_STORAGE; |
| 65 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { | 63 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { |
| 66 *out = PermissionType::VIDEO_CAPTURE; | 64 *out = PermissionType::VIDEO_CAPTURE; |
| 67 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { | 65 } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) { |
| 68 *out = PermissionType::AUDIO_CAPTURE; | 66 *out = PermissionType::AUDIO_CAPTURE; |
| 69 } else if (type == CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC) { | 67 } else if (type == CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC) { |
| 70 *out = PermissionType::BACKGROUND_SYNC; | 68 *out = PermissionType::BACKGROUND_SYNC; |
| 71 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 69 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 72 } else if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) { | 70 } else if (type == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 98 | 96 |
| 99 if (previous_value == CONTENT_SETTING_ALLOW && | 97 if (previous_value == CONTENT_SETTING_ALLOW && |
| 100 final_value != CONTENT_SETTING_ALLOW) { | 98 final_value != CONTENT_SETTING_ALLOW) { |
| 101 PermissionType permission_type; | 99 PermissionType permission_type; |
| 102 if (PermissionUtil::GetPermissionType(content_type, &permission_type)) { | 100 if (PermissionUtil::GetPermissionType(content_type, &permission_type)) { |
| 103 PermissionUmaUtil::PermissionRevoked(permission_type, primary_url, | 101 PermissionUmaUtil::PermissionRevoked(permission_type, primary_url, |
| 104 profile); | 102 profile); |
| 105 } | 103 } |
| 106 } | 104 } |
| 107 } | 105 } |
| OLD | NEW |