Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: extensions/common/features/feature_session_type.h

Issue 2241203003: Pass user session type to extension feature checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass user session type to extension renderer Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/extension_messages.h ('k') | extensions/common/features/feature_session_type.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bd202ceb6cf28b01613c81d0769753b7728348b9
--- /dev/null
+++ b/extensions/common/features/feature_session_type.h
@@ -0,0 +1,45 @@
+// 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 <memory>
+
+#include "base/auto_reset.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 class FeatureSessionType {
+ // Initial session state - before a user logs in.
+ INITIAL = 0,
+ // Represents a session type that cannot be used with feature's session types
+ // property.
+ UNKNOWN = 1,
+ // Regular user session.
+ REGULAR = 2,
+ // Kiosk app session.
+ KIOSK = 3,
+ // Helper for determining max enum value - not used as a real type.
+ LAST = 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.
+std::unique_ptr<base::AutoReset<FeatureSessionType>>
+ScopedCurrentFeatureSessionType(FeatureSessionType type);
+
+} // namespace extensions
+
+#endif // EXTENSIONS_COMMON_FEATURES_FEATURE_SESSION_TYPE_H_
« no previous file with comments | « extensions/common/extension_messages.h ('k') | extensions/common/features/feature_session_type.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698