| 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: | 104 case PermissionType::AMBIENT_LIGHT_SENSOR: |
| 106 return CONTENT_SETTINGS_TYPE_DEFAULT; | 105 return CONTENT_SETTINGS_TYPE_AMBIENT_LIGHT_SENSOR; |
| 107 case PermissionType::ACCELEROMETER: | 106 case PermissionType::ACCELEROMETER: |
| 108 return CONTENT_SETTINGS_TYPE_DEFAULT; | 107 return CONTENT_SETTINGS_TYPE_ACCELEROMETER; |
| 109 case PermissionType::GYROSCOPE: | 108 case PermissionType::GYROSCOPE: |
| 110 return CONTENT_SETTINGS_TYPE_DEFAULT; | 109 return CONTENT_SETTINGS_TYPE_GYROSCOPE; |
| 111 case PermissionType::MAGNETOMETER: | 110 case PermissionType::MAGNETOMETER: |
| 112 return CONTENT_SETTINGS_TYPE_DEFAULT; | 111 return CONTENT_SETTINGS_TYPE_MAGNETOMETER; |
| 113 case PermissionType::ORIENTATION_SENSOR: | 112 case PermissionType::ORIENTATION_SENSOR: |
| 114 return CONTENT_SETTINGS_TYPE_DEFAULT; | 113 return CONTENT_SETTINGS_TYPE_ORIENTATION_SENSOR; |
| 115 case PermissionType::NUM: | 114 case PermissionType::NUM: |
| 116 // This will hit the NOTREACHED below. | 115 // This will hit the NOTREACHED below. |
| 117 break; | 116 break; |
| 118 } | 117 } |
| 119 | 118 |
| 120 NOTREACHED() << "Unknown content setting for permission " | 119 NOTREACHED() << "Unknown content setting for permission " |
| 121 << static_cast<int>(permission); | 120 << static_cast<int>(permission); |
| 122 return CONTENT_SETTINGS_TYPE_DEFAULT; | 121 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 123 } | 122 } |
| 124 | 123 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 558 } |
| 560 PermissionContextBase* context = GetPermissionContext(permission); | 559 PermissionContextBase* context = GetPermissionContext(permission); |
| 561 PermissionResult result = context->GetPermissionStatus( | 560 PermissionResult result = context->GetPermissionStatus( |
| 562 nullptr /* render_frame_host */, requesting_origin.GetOrigin(), | 561 nullptr /* render_frame_host */, requesting_origin.GetOrigin(), |
| 563 embedding_origin.GetOrigin()); | 562 embedding_origin.GetOrigin()); |
| 564 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || | 563 DCHECK(result.content_setting == CONTENT_SETTING_ALLOW || |
| 565 result.content_setting == CONTENT_SETTING_ASK || | 564 result.content_setting == CONTENT_SETTING_ASK || |
| 566 result.content_setting == CONTENT_SETTING_BLOCK); | 565 result.content_setting == CONTENT_SETTING_BLOCK); |
| 567 return result; | 566 return result; |
| 568 } | 567 } |
| OLD | NEW |