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::AMBIENT_LIGHT_SENSOR: |
| 58 return PermissionType::AMBIENT_LIGHT_SENSOR; |
| 59 case PermissionName::ACCELEROMETER: |
| 60 return PermissionType::ACCELEROMETER; |
| 61 case PermissionName::GYROSCOPE: |
| 62 return PermissionType::GYROSCOPE; |
| 63 case PermissionName::MAGNETOMETER: |
| 64 return PermissionType::MAGNETOMETER; |
57 } | 65 } |
58 | 66 |
59 NOTREACHED(); | 67 NOTREACHED(); |
60 return PermissionType::NUM; | 68 return PermissionType::NUM; |
61 } | 69 } |
62 | 70 |
63 blink::WebFeaturePolicyFeature PermissionTypeToFeaturePolicyFeature( | 71 blink::WebFeaturePolicyFeature PermissionTypeToFeaturePolicyFeature( |
64 PermissionType type) { | 72 PermissionType type) { |
65 switch (type) { | 73 switch (type) { |
66 case PermissionType::MIDI: | 74 case PermissionType::MIDI: |
67 case PermissionType::MIDI_SYSEX: | 75 case PermissionType::MIDI_SYSEX: |
68 return blink::WebFeaturePolicyFeature::kMidiFeature; | 76 return blink::WebFeaturePolicyFeature::kMidiFeature; |
69 case PermissionType::GEOLOCATION: | 77 case PermissionType::GEOLOCATION: |
70 return blink::WebFeaturePolicyFeature::kGeolocation; | 78 return blink::WebFeaturePolicyFeature::kGeolocation; |
71 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 79 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
72 return blink::WebFeaturePolicyFeature::kEme; | 80 return blink::WebFeaturePolicyFeature::kEme; |
73 case PermissionType::AUDIO_CAPTURE: | 81 case PermissionType::AUDIO_CAPTURE: |
74 return blink::WebFeaturePolicyFeature::kMicrophone; | 82 return blink::WebFeaturePolicyFeature::kMicrophone; |
75 case PermissionType::VIDEO_CAPTURE: | 83 case PermissionType::VIDEO_CAPTURE: |
76 return blink::WebFeaturePolicyFeature::kCamera; | 84 return blink::WebFeaturePolicyFeature::kCamera; |
77 case PermissionType::PUSH_MESSAGING: | 85 case PermissionType::PUSH_MESSAGING: |
78 case PermissionType::NOTIFICATIONS: | 86 case PermissionType::NOTIFICATIONS: |
79 case PermissionType::DURABLE_STORAGE: | 87 case PermissionType::DURABLE_STORAGE: |
80 case PermissionType::BACKGROUND_SYNC: | 88 case PermissionType::BACKGROUND_SYNC: |
81 case PermissionType::FLASH: | 89 case PermissionType::FLASH: |
| 90 case PermissionType::AMBIENT_LIGHT_SENSOR: |
| 91 case PermissionType::ACCELEROMETER: |
| 92 case PermissionType::GYROSCOPE: |
| 93 case PermissionType::MAGNETOMETER: |
82 case PermissionType::NUM: | 94 case PermissionType::NUM: |
83 // These aren't exposed by feature policy. | 95 // These aren't exposed by feature policy. |
84 return blink::WebFeaturePolicyFeature::kNotFound; | 96 return blink::WebFeaturePolicyFeature::kNotFound; |
85 } | 97 } |
86 | 98 |
87 NOTREACHED(); | 99 NOTREACHED(); |
88 return blink::WebFeaturePolicyFeature::kNotFound; | 100 return blink::WebFeaturePolicyFeature::kNotFound; |
89 } | 101 } |
90 | 102 |
91 bool AllowedByFeaturePolicy(RenderFrameHost* rfh, PermissionType type) { | 103 bool AllowedByFeaturePolicy(RenderFrameHost* rfh, PermissionType type) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 364 |
353 GURL requesting_origin(origin.Serialize()); | 365 GURL requesting_origin(origin.Serialize()); |
354 // If the embedding_origin is empty we'll use |origin| instead. | 366 // If the embedding_origin is empty we'll use |origin| instead. |
355 GURL embedding_origin = context_->GetEmbeddingOrigin(); | 367 GURL embedding_origin = context_->GetEmbeddingOrigin(); |
356 browser_context->GetPermissionManager()->ResetPermission( | 368 browser_context->GetPermissionManager()->ResetPermission( |
357 type, requesting_origin, | 369 type, requesting_origin, |
358 embedding_origin.is_empty() ? requesting_origin : embedding_origin); | 370 embedding_origin.is_empty() ? requesting_origin : embedding_origin); |
359 } | 371 } |
360 | 372 |
361 } // namespace content | 373 } // namespace content |
OLD | NEW |