naiveproxy/ash/public/interfaces/night_light_controller.mojom

53 lines
2.1 KiB
Plaintext
Raw Normal View History

2018-08-11 08:35:24 +03:00
// Copyright 2017 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.
module ash.mojom;
// Represents a geolocation position fix. It's "simple" because it doesn't
// expose all the parameters of the position interface as defined by the
// Geolocation API Specification:
// (https://dev.w3.org/geo/api/spec-source.html#position_interface).
// The NightLightController is only interested in valid latitude and longitude.
// It also doesn't require any specific accuracy. The more accurate the
// positions, the more accurate sunset and sunrise times calculations. However,
// an IP-based geoposition is considered good enough.
struct SimpleGeoposition {
double latitude;
double longitude;
};
// Used by a client (e.g. Chrome) to provide the current user's geoposition.
interface NightLightController {
// These values are written to logs. New enum values can be added, but
// existing enums must never be renumbered or deleted and reused.
enum ScheduleType {
// Automatic toggling of NightLight is turned off.
kNone = 0,
// Turned automatically on at the user's local sunset time, and off at the
// user's local sunrise time.
kSunsetToSunrise = 1,
// Toggled automatically based on the custom set start and end times
// selected by the user from the system settings.
kCustom = 2,
};
// Sets the client that will be notified of changes in the Night Light
// schedule type.
SetClient(NightLightClient client);
// Provides the NightLightController with the user's geoposition so that it
// can calculate the sunset and sunrise times. This should only be called when
// the schedule type is set to "Sunset to Sunrise".
SetCurrentGeoposition(SimpleGeoposition position);
};
// Used by ash to notify a client (e.g. Chrome) of the changes in the Night
// Light schedule type.
interface NightLightClient {
// Notifies the client with the new schedule type whenever it changes.
OnScheduleTypeChanged(NightLightController.ScheduleType new_type);
};