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