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_manager.h" | 5 #include "chrome/browser/permissions/permission_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 case PermissionType::DURABLE_STORAGE: | 94 case PermissionType::DURABLE_STORAGE: |
95 return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE; | 95 return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE; |
96 case PermissionType::AUDIO_CAPTURE: | 96 case PermissionType::AUDIO_CAPTURE: |
97 return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC; | 97 return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC; |
98 case PermissionType::VIDEO_CAPTURE: | 98 case PermissionType::VIDEO_CAPTURE: |
99 return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; | 99 return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA; |
100 case PermissionType::BACKGROUND_SYNC: | 100 case PermissionType::BACKGROUND_SYNC: |
101 return CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC; | 101 return CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC; |
102 case PermissionType::FLASH: | 102 case PermissionType::FLASH: |
103 return CONTENT_SETTINGS_TYPE_PLUGINS; | 103 return CONTENT_SETTINGS_TYPE_PLUGINS; |
| 104 // TODO(riju): Add ContentSetting entries for sensors later. |
| 105 case PermissionType::AMBIENT_LIGHT_SENSOR: |
| 106 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 107 case PermissionType::ACCELEROMETER: |
| 108 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 109 case PermissionType::GYROSCOPE: |
| 110 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 111 case PermissionType::MAGNETOMETER: |
| 112 return CONTENT_SETTINGS_TYPE_DEFAULT; |
104 case PermissionType::NUM: | 113 case PermissionType::NUM: |
105 // This will hit the NOTREACHED below. | 114 // This will hit the NOTREACHED below. |
106 break; | 115 break; |
107 } | 116 } |
108 | 117 |
109 NOTREACHED() << "Unknown content setting for permission " | 118 NOTREACHED() << "Unknown content setting for permission " |
110 << static_cast<int>(permission); | 119 << static_cast<int>(permission); |
111 return CONTENT_SETTINGS_TYPE_DEFAULT; | 120 return CONTENT_SETTINGS_TYPE_DEFAULT; |
112 } | 121 } |
113 | 122 |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 560 } |
552 PermissionContextBase* context = GetPermissionContext(permission); | 561 PermissionContextBase* context = GetPermissionContext(permission); |
553 PermissionResult result = context->GetPermissionStatus( | 562 PermissionResult result = context->GetPermissionStatus( |
554 nullptr /* render_frame_host */, requesting_origin.GetOrigin(), | 563 nullptr /* render_frame_host */, requesting_origin.GetOrigin(), |
555 embedding_origin.GetOrigin()); | 564 embedding_origin.GetOrigin()); |
556 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || | 565 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || |
557 result.content_setting == CONTENT_SETTING_ASK || | 566 result.content_setting == CONTENT_SETTING_ASK || |
558 result.content_setting == CONTENT_SETTING_BLOCK); | 567 result.content_setting == CONTENT_SETTING_BLOCK); |
559 return result; | 568 return result; |
560 } | 569 } |
OLD | NEW |