Chromium Code Reviews| 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 |