Chromium Code Reviews| Index: extensions/common/features/feature_session_type.h |
| diff --git a/extensions/common/features/feature_session_type.h b/extensions/common/features/feature_session_type.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..51811c68d8cbe3a5348ae33c859741733025423c |
| --- /dev/null |
| +++ b/extensions/common/features/feature_session_type.h |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2016 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. |
| + |
| +#ifndef EXTENSIONS_COMMON_FEATURES_FEATURE_SESSION_TYPE_H_ |
| +#define EXTENSIONS_COMMON_FEATURES_FEATURE_SESSION_TYPE_H_ |
| + |
| +#include "base/macros.h" |
| + |
| +namespace extensions { |
| + |
| +// Classes of session types to which features can be restricted in feature |
| +// files. The session type describes session based on the type of user that is |
| +// active in the current session. |
| +enum FeatureSessionType { |
| + FEATURE_SESSION_TYPE_UNSPECIFIED, |
| + // Regular session, i.e. non kiosk app. |
| + FEATURE_SESSION_TYPE_REGULAR, |
|
rkc
2016/08/17 23:07:24
We will definitely want to add more states later,
tbarzic
2016/08/18 01:05:33
Done. Kept REGULAR user per offline discussion.
|
| + // Kiosk app session. |
| + FEATURE_SESSION_TYPE_KIOSK, |
| + // Helper for determining max enum value - not used as a real type. |
| + FEATURE_SESSION_TYPE_MAX = FEATURE_SESSION_TYPE_KIOSK |
| +}; |
| + |
| +// Gets the current session type as seen by the Feature system. |
| +FeatureSessionType GetCurrentFeatureSessionType(); |
| + |
| +// Sets the current session type as seen by the Feature system. In the browser |
| +// process this should be extensions::util::GetCurrentSessionType(), and in |
| +// the renderer this will need to come from an IPC. |
| +void SetCurrentFeatureSessionType(FeatureSessionType session_type); |
| + |
| +// Scoped session type setter. Use for tests. |
| +class ScopedCurrentFeatureSessionType { |
| + public: |
| + explicit ScopedCurrentFeatureSessionType(FeatureSessionType session_type); |
| + ~ScopedCurrentFeatureSessionType(); |
| + |
| + private: |
| + FeatureSessionType original_session_type_{FEATURE_SESSION_TYPE_UNSPECIFIED}; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ScopedCurrentFeatureSessionType); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // EXTENSIONS_COMMON_FEATURES_FEATURE_SESSION_TYPE_H_ |