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

Side by Side Diff: device/generic_sensor/public/interfaces/sensor.mojom

Issue 2353493002: [Sensors] Allow Sensor API only on secure top-level browsing contexts and add frequency checks (Closed)
Patch Set: Comments from Tim Created 4 years, 3 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 module device.mojom; 5 module device.mojom;
6 6
7 // Types of supported sensors 7 // Types of supported sensors
8 enum SensorType { 8 enum SensorType {
9 FIRST = 1, 9 FIRST = 1,
10 AMBIENT_LIGHT = FIRST, 10 AMBIENT_LIGHT = FIRST,
(...skipping 12 matching lines...) Expand all
23 // CONTINUOUS - sensor will continuously update its reading with frequency 23 // CONTINUOUS - sensor will continuously update its reading with frequency
24 // specified in SensorConfiguration.frequency. 24 // specified in SensorConfiguration.frequency.
25 // OnSensorReadingChanged() signal is not sent to the client for 25 // OnSensorReadingChanged() signal is not sent to the client for
26 // sensors with CONTINUOUS reporting mode. 26 // sensors with CONTINUOUS reporting mode.
27 enum ReportingMode { 27 enum ReportingMode {
28 ON_CHANGE, 28 ON_CHANGE,
29 CONTINUOUS 29 CONTINUOUS
30 }; 30 };
31 31
32 struct SensorConfiguration { 32 struct SensorConfiguration {
33 // Requested frequency in Hz (max is 60 Hz). 33 // Maximum allowed frequency is 60 Hz.
34 const double kMaxAllowedFrequency = 60.0;
Tom Sepez 2016/09/20 16:41:06 nit: If we named this kMaxAllowedFrequencyHz, we c
35
36 // Requested frequency in Hz.
34 double frequency; 37 double frequency;
35 // TODO(shalamov): Add map<string, union> for sensor specific configuration. 38 // TODO(shalamov): Add map<string, union> for sensor specific configuration.
36 }; 39 };
37 40
38 // Interface for controlling the Sensor. 41 // Interface for controlling the Sensor.
39 interface Sensor { 42 interface Sensor {
40 43
41 // Requests sensor to provide its default configuration. 44 // Requests sensor to provide its default configuration.
42 GetDefaultConfiguration() => (SensorConfiguration configuration); 45 GetDefaultConfiguration() => (SensorConfiguration configuration);
43 46
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Interface that client of the Sensor interface must implement to observe 78 // Interface that client of the Sensor interface must implement to observe
76 // sensor reading changes and error conditions. 79 // sensor reading changes and error conditions.
77 interface SensorClient { 80 interface SensorClient {
78 // Signals SensorClient when there is an error. 81 // Signals SensorClient when there is an error.
79 RaiseError(); 82 RaiseError();
80 83
81 // Signals SensorClient when reading has been changed (only for sensors with 84 // Signals SensorClient when reading has been changed (only for sensors with
82 // ReportingMode::ON_CHANGE). 85 // ReportingMode::ON_CHANGE).
83 SensorReadingChanged(); 86 SensorReadingChanged();
84 }; 87 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698