Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/browser/sensor/sensor_permission_context.cc

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: rebase + blink reformat Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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, CONTENT_SETTINGS_TYPE_SENSORS) {}
17
18 SensorPermissionContext::~SensorPermissionContext() {}
19
20 void SensorPermissionContext::UpdateTabContext(const PermissionRequestID& id,
21 const GURL& requesting_frame,
22 bool allowed) {
23 TabSpecificContentSettings* content_settings =
24 TabSpecificContentSettings::GetForFrame(id.render_process_id(),
25 id.render_frame_id());
26 if (!content_settings)
27 return;
28
29 if (allowed)
30 content_settings->OnSensorAccessed(requesting_frame);
31 else
32 content_settings->OnSensorAccessBlocked(requesting_frame);
33 }
34
35 bool SensorPermissionContext::IsRestrictedToSecureOrigins() const {
36 return true;
37 }
OLDNEW
« no previous file with comments | « chrome/browser/sensor/sensor_permission_context.h ('k') | chrome/browser/sensor/sensor_permission_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698