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#ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_SESSION_TYPE_H_
6#define EXTENSIONS_COMMON_FEATURES_FEATURE_SESSION_TYPE_H_
7
8#include <memory>
9
10#include "base/auto_reset.h"
11
12namespace extensions {
13
14// Classes of session types to which features can be restricted in feature
15// files. The session type describes session based on the type of user that is
16// active in the current session.
17enum class FeatureSessionType {
18 // Initial session state - before a user logs in.
19 INITIAL = 0,
20 // Represents a session type that cannot be used with feature's session types
21 // property.
22 UNKNOWN = 1,
23 // Regular user session.
24 REGULAR = 2,
25 // Kiosk app session.
26 KIOSK = 3,
27 // Kiosk app session that's been auto-launched from login screen (without
28 // any user interaction).
29 AUTOLAUNCHED_KIOSK = 4,
30 // Helper for determining max enum value - not used as a real type.
31 LAST = AUTOLAUNCHED_KIOSK
32};
33
34// Gets the current session type as seen by the Feature system.
35FeatureSessionType GetCurrentFeatureSessionType();
36
37// Sets the current session type as seen by the Feature system. In the browser
38// process this should be extensions::util::GetCurrentSessionType(), and in
39// the renderer this will need to come from an IPC.
40void SetCurrentFeatureSessionType(FeatureSessionType session_type);
41
42// Scoped session type setter. Use for tests.
43std::unique_ptr<base::AutoReset<FeatureSessionType>>
44ScopedCurrentFeatureSessionType(FeatureSessionType session_type);
45
46} // namespace extensions
47
48#endif // EXTENSIONS_COMMON_FEATURES_FEATURE_SESSION_TYPE_H_
49