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

Unified Diff: ash/common/session/session_controller.h

Issue 2545723003: ash: Add SessionController/Client mojo interfaces (Closed)
Patch Set: use a default to fix null avatar image failures Created 4 years 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
Index: ash/common/session/session_controller.h
diff --git a/ash/common/session/session_controller.h b/ash/common/session/session_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..0deca323f89caa0e5115f049a44bd74536dc391d
--- /dev/null
+++ b/ash/common/session/session_controller.h
@@ -0,0 +1,80 @@
+// 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 ASH_COMMON_SESSION_SESSION_CONTROLLER_H_
+#define ASH_COMMON_SESSION_SESSION_CONTROLLER_H_
+
+#include "ash/public/cpp/session_types.h"
+#include "ash/public/interfaces/session_controller.mojom.h"
+#include "base/macros.h"
+#include "base/observer_list.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+
+class AccountId;
+
+namespace ash {
+
+class SessionStateObserver;
+
+class SessionController : public mojom::SessionController {
James Cook 2016/12/01 23:01:43 Class comment please
xiyuan 2016/12/06 00:46:34 Done.
+ public:
+ SessionController();
+ ~SessionController() override;
+
+ // Binds the mojom::SessionControllerRequest to this object.
+ void BindRequest(mojom::SessionControllerRequest request);
+
+ // Replacement of SessionStateDelegate interface.
James Cook 2016/12/01 23:01:43 Move or duplicate the SessionStateDelegate functio
xiyuan 2016/12/06 00:46:34 Done.
+ int GetMaximumNumberOfLoggedInUsers() const;
+ int NumberOfLoggedInUsers() const;
+ AddUserSessionPolicy GetAddUserPolicy() const;
+ bool IsActiveUserSessionStarted() const;
+ bool CanLockScreen() const;
+ bool IsScreenLocked() const;
+ bool ShouldLockScreenAutomatically() const;
+ bool IsUserSessionBlocked() const;
+ session_manager::SessionState GetSessionState() const;
+ const std::vector<mojom::UserSessionPtr>& GetUserSessions() const;
+
+ void LockScreen();
James Cook 2016/12/01 23:01:43 nit: Comment that these mirror or are wrappers aro
xiyuan 2016/12/06 00:46:34 Copied SessionStateDelegate comments to them.
+ void SwitchActiveUser(const AccountId& account_id);
+ void CycleActiveUser(bool next_user);
+
+ void AddSessionStateObserver(SessionStateObserver* observer);
+ void RemoveSessionStateObserver(SessionStateObserver* observer);
+
+ // mojom::SessionController
+ void SetClient(mojom::SessionControllerClientPtr client) override;
+ void SetMaxUsers(uint32_t max_users) override;
+ void SetCanLockScreen(bool can_lock) override;
+ void SetShouldLockScreenAutomatically(bool should_lock) override;
+ void SetAddUserSessionPolicy(
+ AddUserSessionPolicy add_user_session_policy) override;
+ void SetSessionState(session_manager::SessionState state) override;
+ void SetUserSessions(
+ std::vector<mojom::UserSessionPtr> user_sessions) override;
+
+ private:
+ // Bindings for mojom::SessionController interface.
+ mojo::BindingSet<mojom::SessionController> bindings_;
+
+ // Client interface to Chrome. Only bound on Chrome OS.
James Cook 2016/12/01 23:01:43 nit: remove "Only bound on Chrome OS". I'm in the
xiyuan 2016/12/06 00:46:34 Done.
+ mojom::SessionControllerClientPtr client_;
+
+ // Cached session info.
+ uint32_t max_users_ = 0u;
James Cook 2016/12/01 23:01:43 #include <stdint.h> or just use int, I'm not pick
xiyuan 2016/12/06 00:46:34 Done.
+ bool can_lock_ = false;
+ bool should_lock_screen_automatically_ = false;
+ AddUserSessionPolicy add_user_session_policy_ = AddUserSessionPolicy::ALLOWED;
+ session_manager::SessionState state_ = session_manager::SessionState::UNKNOWN;
+ std::vector<mojom::UserSessionPtr> user_sessions_;
+
+ base::ObserverList<ash::SessionStateObserver> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(SessionController);
+};
+
+} // namespace ash
+
+#endif // ASH_COMMON_SESSION_SESSION_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698