Fix emulator build error
[platform/framework/web/chromium-efl.git] / components / permissions / request_type.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_REQUEST_TYPE_H_
6 #define COMPONENTS_PERMISSIONS_REQUEST_TYPE_H_
7
8 #include "build/build_config.h"
9 #include "build/chromeos_buildflags.h"
10 #include "third_party/abseil-cpp/absl/types/optional.h"
11
12 enum class ContentSettingsType;
13
14 namespace gfx {
15 struct VectorIcon;
16 }
17
18 namespace permissions {
19
20 // The type of the request that will be seen by the user. Values are only
21 // defined on the platforms where they are used and should be kept alphabetized.
22 enum class RequestType {
23   kAccessibilityEvents,
24   kArSession,
25 #if !BUILDFLAG(IS_ANDROID)
26   kCameraPanTiltZoom,
27 #endif
28   kCameraStream,
29   kClipboard,
30   kTopLevelStorageAccess,
31   kDiskQuota,
32 #if !BUILDFLAG(IS_ANDROID)
33   kFileSystemAccess,
34 #endif
35   kGeolocation,
36   kIdleDetection,
37 #if !BUILDFLAG(IS_ANDROID)
38   kLocalFonts,
39 #endif
40   kMicStream,
41   kMidi,
42   kMidiSysex,
43   kMultipleDownloads,
44 #if BUILDFLAG(IS_ANDROID)
45   kNfcDevice,
46 #endif
47   kNotifications,
48 #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
49   kProtectedMediaIdentifier,
50 #endif
51 #if !BUILDFLAG(IS_ANDROID)
52   kRegisterProtocolHandler,
53 #endif
54   kStorageAccess,
55   kVrSession,
56 #if !BUILDFLAG(IS_ANDROID)
57   kWindowManagement,
58   kMaxValue = kWindowManagement
59 #else
60   kMaxValue = kVrSession
61 #endif
62 };
63
64 #if BUILDFLAG(IS_ANDROID)
65 // On Android, icons are represented with an IDR_ identifier.
66 using IconId = int;
67 #else
68 // On desktop, we use a vector icon.
69 typedef const gfx::VectorIcon& IconId;
70 #endif
71
72 bool IsRequestablePermissionType(ContentSettingsType content_settings_type);
73
74 absl::optional<RequestType> ContentSettingsTypeToRequestTypeIfExists(
75     ContentSettingsType content_settings_type);
76
77 RequestType ContentSettingsTypeToRequestType(
78     ContentSettingsType content_settings_type);
79
80 absl::optional<ContentSettingsType> RequestTypeToContentSettingsType(
81     RequestType request_type);
82
83 // Returns whether confirmation chips can be displayed
84 bool IsConfirmationChipSupported(RequestType for_request_type);
85
86 // Returns the icon to display.
87 IconId GetIconId(RequestType type);
88
89 #if !BUILDFLAG(IS_ANDROID)
90 // Returns the blocked icon to display.
91 IconId GetBlockedIconId(RequestType type);
92 #endif
93
94 // Returns a unique human-readable string that can be used in dictionaries that
95 // are keyed by the RequestType.
96 const char* PermissionKeyForRequestType(permissions::RequestType request_type);
97
98 }  // namespace permissions
99
100 #endif  // COMPONENTS_PERMISSIONS_REQUEST_TYPE_H_