| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/permissions/permission_service_impl.h" | 5 #include "content/browser/permissions/permission_service_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 case PermissionName::PROTECTED_MEDIA_IDENTIFIER: | 47 case PermissionName::PROTECTED_MEDIA_IDENTIFIER: |
| 48 return PermissionType::PROTECTED_MEDIA_IDENTIFIER; | 48 return PermissionType::PROTECTED_MEDIA_IDENTIFIER; |
| 49 case PermissionName::DURABLE_STORAGE: | 49 case PermissionName::DURABLE_STORAGE: |
| 50 return PermissionType::DURABLE_STORAGE; | 50 return PermissionType::DURABLE_STORAGE; |
| 51 case PermissionName::AUDIO_CAPTURE: | 51 case PermissionName::AUDIO_CAPTURE: |
| 52 return PermissionType::AUDIO_CAPTURE; | 52 return PermissionType::AUDIO_CAPTURE; |
| 53 case PermissionName::VIDEO_CAPTURE: | 53 case PermissionName::VIDEO_CAPTURE: |
| 54 return PermissionType::VIDEO_CAPTURE; | 54 return PermissionType::VIDEO_CAPTURE; |
| 55 case PermissionName::BACKGROUND_SYNC: | 55 case PermissionName::BACKGROUND_SYNC: |
| 56 return PermissionType::BACKGROUND_SYNC; | 56 return PermissionType::BACKGROUND_SYNC; |
| 57 case PermissionName::PAYMENT_HANDLER: |
| 58 return PermissionType::PAYMENT_HANDLER; |
| 57 } | 59 } |
| 58 | 60 |
| 59 NOTREACHED(); | 61 NOTREACHED(); |
| 60 return PermissionType::NUM; | 62 return PermissionType::NUM; |
| 61 } | 63 } |
| 62 | 64 |
| 63 blink::WebFeaturePolicyFeature PermissionTypeToFeaturePolicyFeature( | 65 blink::WebFeaturePolicyFeature PermissionTypeToFeaturePolicyFeature( |
| 64 PermissionType type) { | 66 PermissionType type) { |
| 65 switch (type) { | 67 switch (type) { |
| 66 case PermissionType::MIDI: | 68 case PermissionType::MIDI: |
| 67 case PermissionType::MIDI_SYSEX: | 69 case PermissionType::MIDI_SYSEX: |
| 68 return blink::WebFeaturePolicyFeature::kMidiFeature; | 70 return blink::WebFeaturePolicyFeature::kMidiFeature; |
| 69 case PermissionType::GEOLOCATION: | 71 case PermissionType::GEOLOCATION: |
| 70 return blink::WebFeaturePolicyFeature::kGeolocation; | 72 return blink::WebFeaturePolicyFeature::kGeolocation; |
| 71 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 73 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 72 return blink::WebFeaturePolicyFeature::kEme; | 74 return blink::WebFeaturePolicyFeature::kEme; |
| 73 case PermissionType::AUDIO_CAPTURE: | 75 case PermissionType::AUDIO_CAPTURE: |
| 74 return blink::WebFeaturePolicyFeature::kMicrophone; | 76 return blink::WebFeaturePolicyFeature::kMicrophone; |
| 75 case PermissionType::VIDEO_CAPTURE: | 77 case PermissionType::VIDEO_CAPTURE: |
| 76 return blink::WebFeaturePolicyFeature::kCamera; | 78 return blink::WebFeaturePolicyFeature::kCamera; |
| 77 case PermissionType::PUSH_MESSAGING: | 79 case PermissionType::PUSH_MESSAGING: |
| 78 case PermissionType::NOTIFICATIONS: | 80 case PermissionType::NOTIFICATIONS: |
| 79 case PermissionType::DURABLE_STORAGE: | 81 case PermissionType::DURABLE_STORAGE: |
| 80 case PermissionType::BACKGROUND_SYNC: | 82 case PermissionType::BACKGROUND_SYNC: |
| 83 case PermissionType::PAYMENT_HANDLER: |
| 81 case PermissionType::FLASH: | 84 case PermissionType::FLASH: |
| 82 case PermissionType::NUM: | 85 case PermissionType::NUM: |
| 83 // These aren't exposed by feature policy. | 86 // These aren't exposed by feature policy. |
| 84 return blink::WebFeaturePolicyFeature::kNotFound; | 87 return blink::WebFeaturePolicyFeature::kNotFound; |
| 85 } | 88 } |
| 86 | 89 |
| 87 NOTREACHED(); | 90 NOTREACHED(); |
| 88 return blink::WebFeaturePolicyFeature::kNotFound; | 91 return blink::WebFeaturePolicyFeature::kNotFound; |
| 89 } | 92 } |
| 90 | 93 |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 355 |
| 353 GURL requesting_origin(origin.Serialize()); | 356 GURL requesting_origin(origin.Serialize()); |
| 354 // If the embedding_origin is empty we'll use |origin| instead. | 357 // If the embedding_origin is empty we'll use |origin| instead. |
| 355 GURL embedding_origin = context_->GetEmbeddingOrigin(); | 358 GURL embedding_origin = context_->GetEmbeddingOrigin(); |
| 356 browser_context->GetPermissionManager()->ResetPermission( | 359 browser_context->GetPermissionManager()->ResetPermission( |
| 357 type, requesting_origin, | 360 type, requesting_origin, |
| 358 embedding_origin.is_empty() ? requesting_origin : embedding_origin); | 361 embedding_origin.is_empty() ? requesting_origin : embedding_origin); |
| 359 } | 362 } |
| 360 | 363 |
| 361 } // namespace content | 364 } // namespace content |
| OLD | NEW |