| Index: chrome/browser/sensor/sensor_permission_context.cc
|
| diff --git a/chrome/browser/sensor/sensor_permission_context.cc b/chrome/browser/sensor/sensor_permission_context.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..08ca7de733fcfab1ca42f3312d4a7f9fc8176bec
|
| --- /dev/null
|
| +++ b/chrome/browser/sensor/sensor_permission_context.cc
|
| @@ -0,0 +1,39 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/sensor/sensor_permission_context.h"
|
| +
|
| +#include "chrome/browser/content_settings/tab_specific_content_settings.h"
|
| +#include "chrome/browser/permissions/permission_request_id.h"
|
| +#include "content/public/browser/child_process_security_policy.h"
|
| +#include "content/public/browser/permission_type.h"
|
| +#include "content/public/browser/render_frame_host.h"
|
| +#include "content/public/browser/web_contents.h"
|
| +#include "url/gurl.h"
|
| +
|
| +SensorPermissionContext::SensorPermissionContext(Profile* profile)
|
| + : PermissionContextBase(profile,
|
| + content::PermissionType::SENSORS,
|
| + CONTENT_SETTINGS_TYPE_SENSORS) {}
|
| +
|
| +SensorPermissionContext::~SensorPermissionContext() {}
|
| +
|
| +void SensorPermissionContext::UpdateTabContext(const PermissionRequestID& id,
|
| + const GURL& requesting_frame,
|
| + bool allowed) {
|
| + TabSpecificContentSettings* content_settings =
|
| + TabSpecificContentSettings::GetForFrame(id.render_process_id(),
|
| + id.render_frame_id());
|
| + if (!content_settings)
|
| + return;
|
| +
|
| + if (allowed)
|
| + content_settings->OnSensorAccessed(requesting_frame);
|
| + else
|
| + content_settings->OnSensorAccessBlocked(requesting_frame);
|
| +}
|
| +
|
| +bool SensorPermissionContext::IsRestrictedToSecureOrigins() const {
|
| + return true;
|
| +}
|
|
|