OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/sensor/sensor_permission_context.h" |
| 6 |
| 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 8 #include "chrome/browser/permissions/permission_request_id.h" |
| 9 #include "content/public/browser/child_process_security_policy.h" |
| 10 #include "content/public/browser/permission_type.h" |
| 11 #include "content/public/browser/render_frame_host.h" |
| 12 #include "content/public/browser/web_contents.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 SensorPermissionContext::SensorPermissionContext(Profile* profile) |
| 16 : PermissionContextBase(profile, |
| 17 content::PermissionType::SENSORS, |
| 18 CONTENT_SETTINGS_TYPE_SENSORS) {} |
| 19 |
| 20 SensorPermissionContext::~SensorPermissionContext() {} |
| 21 |
| 22 void SensorPermissionContext::UpdateTabContext(const PermissionRequestID& id, |
| 23 const GURL& requesting_frame, |
| 24 bool allowed) { |
| 25 TabSpecificContentSettings* content_settings = |
| 26 TabSpecificContentSettings::GetForFrame(id.render_process_id(), |
| 27 id.render_frame_id()); |
| 28 if (!content_settings) |
| 29 return; |
| 30 |
| 31 if (allowed) |
| 32 content_settings->OnSensorAccessed(requesting_frame); |
| 33 else |
| 34 content_settings->OnSensorAccessBlocked(requesting_frame); |
| 35 } |
| 36 |
| 37 bool SensorPermissionContext::IsRestrictedToSecureOrigins() const { |
| 38 return true; |
| 39 } |
OLD | NEW |