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

Unified Diff: ash/shell/example_session_controller_client.cc

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase Created 3 years, 9 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
Index: ash/shell/example_session_controller_client.cc
diff --git a/ash/shell/example_session_controller_client.cc b/ash/shell/example_session_controller_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bff5dee2a645a7722d4b061045f3a3efd30e8d56
--- /dev/null
+++ b/ash/shell/example_session_controller_client.cc
@@ -0,0 +1,54 @@
+// Copyright 2017 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.
+
+#include "ash/shell/example_session_controller_client.h"
+
+#include "ash/shell.h"
+#include "ash/shell/example_factory.h"
+#include "base/logging.h"
+
+namespace ash {
+namespace shell {
+
+namespace {
+
+ExampleSessionControllerClient* instance = nullptr;
+
+} // namespace
+
+ExampleSessionControllerClient::ExampleSessionControllerClient(
+ SessionController* controller)
+ : TestSessionControllerClient(controller) {
+ DCHECK_EQ(instance, nullptr);
James Cook 2017/03/17 17:14:36 nit: Also DCHECK(controller)
xiyuan 2017/03/17 22:52:03 Done.
+ instance = this;
+}
+
+ExampleSessionControllerClient::~ExampleSessionControllerClient() {
+ DCHECK_EQ(instance, this);
+ instance = nullptr;
+}
+
+// static
+ExampleSessionControllerClient* ExampleSessionControllerClient::Get() {
+ return instance;
+}
+
+void ExampleSessionControllerClient::Initialize() {
+ // ash_shell has 2 users.
+ SetPredefinedUserSessions(2);
+}
+
+void ExampleSessionControllerClient::RequestLockScreen() {
+ TestSessionControllerClient::RequestLockScreen();
+ shell::CreateLockScreen();
+ Shell::GetInstance()->UpdateShelfVisibility();
+}
+
+void ExampleSessionControllerClient::UnlockScreen() {
+ TestSessionControllerClient::UnlockScreen();
+ Shell::GetInstance()->UpdateShelfVisibility();
+}
+
+} // namespace shell
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698