blob: aebf375a95b439f00b0528e2a6de58c33e9c3b02 [file] [log] [blame]
xiyuanf1ff14d2017-03-20 20:28:141// Copyright 2017 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#include "ash/shell/example_session_controller_client.h"
6
7#include "ash/shell.h"
8#include "ash/shell/example_factory.h"
9#include "base/logging.h"
10
11namespace ash {
12namespace shell {
13
14namespace {
15
16ExampleSessionControllerClient* instance = nullptr;
17
18} // namespace
19
20ExampleSessionControllerClient::ExampleSessionControllerClient(
21 SessionController* controller)
22 : TestSessionControllerClient(controller) {
23 DCHECK_EQ(instance, nullptr);
24 DCHECK(controller);
25 instance = this;
26}
27
28ExampleSessionControllerClient::~ExampleSessionControllerClient() {
29 DCHECK_EQ(instance, this);
30 instance = nullptr;
31}
32
33// static
34ExampleSessionControllerClient* ExampleSessionControllerClient::Get() {
35 return instance;
36}
37
38void ExampleSessionControllerClient::Initialize() {
xiyuan233f4e72017-04-06 06:59:5639 // Initialize and bind with the session controller.
40 InitializeAndBind();
41
xiyuanf1ff14d2017-03-20 20:28:1442 // ash_shell has 2 users.
43 CreatePredefinedUserSessions(2);
44}
45
46void ExampleSessionControllerClient::RequestLockScreen() {
47 TestSessionControllerClient::RequestLockScreen();
48 shell::CreateLockScreen();
skycb4be5b2017-04-06 17:52:4549 Shell::Get()->UpdateShelfVisibility();
xiyuanf1ff14d2017-03-20 20:28:1450}
51
52void ExampleSessionControllerClient::UnlockScreen() {
53 TestSessionControllerClient::UnlockScreen();
skycb4be5b2017-04-06 17:52:4554 Shell::Get()->UpdateShelfVisibility();
xiyuanf1ff14d2017-03-20 20:28:1455}
56
57} // namespace shell
58} // namespace ash