Fix emulator build error
[platform/framework/web/chromium-efl.git] / components / permissions / permission_usage_session.h
1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_PERMISSIONS_PERMISSION_USAGE_SESSION_H_
6 #define COMPONENTS_PERMISSIONS_PERMISSION_USAGE_SESSION_H_
7
8 #include "base/time/time.h"
9 #include "components/content_settings/core/common/content_settings_types.h"
10 #include "url/origin.h"
11
12 namespace permissions {
13
14 // Stores information about a permission usage session, which is a continuous
15 // time interval during which some permission was used by some site. For
16 // instance, a usage session could be a time interval during which a site
17 // accessed the camera. {type, origin, usage_start} forms the primary of a
18 // session.
19 struct PermissionUsageSession {
20   //  The `origin` accessing the capability. Must not be opaque.
21   url::Origin origin;
22
23   ContentSettingsType type;
24
25   // The time interval in which the capability was accessed, such that
26   // `usage_start` <= `usage_end`, and neither is null.
27   base::Time usage_start;
28   base::Time usage_end;
29
30   // Specifies if the permission usage started with the browsing context having
31   // transient user activation.
32   bool had_user_activation;
33
34   // Specifies if the permission usage started in the foreground.
35   bool was_foreground;
36
37   // Specifies if the requesting frame had focus at the time the permission.
38   // usage started.
39   bool had_focus;
40
41   bool operator==(const PermissionUsageSession& other) const;
42   bool operator!=(const PermissionUsageSession& other) const;
43
44   // Checks if the session satisfies the following constraints:
45   // 1) `origin` is not opaque;
46   // 2) `usage_start` and `usage_end` are not null;
47   // 3) `usage_start` <= `usage_end`.
48   bool IsValid() const;
49 };
50
51 }  // namespace permissions
52
53 #endif  // COMPONENTS_PERMISSIONS_PERMISSION_USAGE_SESSION_H_