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