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

Unified Diff: mash/shell/shell_application_delegate.cc

Issue 1817443002: Rename mash_shell to mash_session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « mash/shell/shell_application_delegate.h ('k') | mash/wm/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mash/shell/shell_application_delegate.cc
diff --git a/mash/shell/shell_application_delegate.cc b/mash/shell/shell_application_delegate.cc
deleted file mode 100644
index 408ec7f9986d8b8d4ff4b41c7e02d39a508bf800..0000000000000000000000000000000000000000
--- a/mash/shell/shell_application_delegate.cc
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2015 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 "mash/shell/shell_application_delegate.h"
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/message_loop/message_loop.h"
-#include "mash/login/public/interfaces/login.mojom.h"
-#include "mojo/shell/public/cpp/connection.h"
-#include "mojo/shell/public/cpp/connector.h"
-
-namespace mash {
-namespace shell {
-
-ShellApplicationDelegate::ShellApplicationDelegate()
- : connector_(nullptr), screen_locked_(false) {}
-
-ShellApplicationDelegate::~ShellApplicationDelegate() {}
-
-void ShellApplicationDelegate::Initialize(mojo::Connector* connector,
- const mojo::Identity& identity,
- uint32_t id) {
- connector_ = connector;
- StartBrowserDriver();
- StartWindowManager();
- StartSystemUI();
- StartQuickLaunch();
-}
-
-bool ShellApplicationDelegate::AcceptConnection(mojo::Connection* connection) {
- connection->AddInterface<mojom::Shell>(this);
- return true;
-}
-
-void ShellApplicationDelegate::Logout() {
- // TODO(beng): Notify connected listeners that login is happening, potentially
- // give them the option to stop it.
- mash::login::mojom::LoginPtr login;
- connector_->ConnectToInterface("mojo:login", &login);
- login->ShowLoginUI();
- // This kills the user environment.
- base::MessageLoop::current()->QuitWhenIdle();
-}
-
-void ShellApplicationDelegate::SwitchUser() {
- mash::login::mojom::LoginPtr login;
- connector_->ConnectToInterface("mojo:login", &login);
- login->SwitchUser();
-}
-
-void ShellApplicationDelegate::AddScreenlockStateListener(
- mojom::ScreenlockStateListenerPtr listener) {
- listener->ScreenlockStateChanged(screen_locked_);
- screenlock_listeners_.AddInterfacePtr(std::move(listener));
-}
-
-void ShellApplicationDelegate::LockScreen() {
- if (screen_locked_)
- return;
- screen_locked_ = true;
- screenlock_listeners_.ForAllPtrs(
- [](mojom::ScreenlockStateListener* listener) {
- listener->ScreenlockStateChanged(true);
- });
- StartScreenlock();
-}
-void ShellApplicationDelegate::UnlockScreen() {
- if (!screen_locked_)
- return;
- screen_locked_ = false;
- screenlock_listeners_.ForAllPtrs(
- [](mojom::ScreenlockStateListener* listener) {
- listener->ScreenlockStateChanged(false);
- });
- StopScreenlock();
-}
-
-void ShellApplicationDelegate::Create(
- mojo::Connection* connection,
- mojom::ShellRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-void ShellApplicationDelegate::StartWindowManager() {
- StartRestartableService(
- "mojo:desktop_wm",
- base::Bind(&ShellApplicationDelegate::StartWindowManager,
- base::Unretained(this)));
-}
-
-void ShellApplicationDelegate::StartSystemUI() {
- StartRestartableService("mojo:ash_sysui",
- base::Bind(&ShellApplicationDelegate::StartSystemUI,
- base::Unretained(this)));
-}
-
-void ShellApplicationDelegate::StartBrowserDriver() {
- StartRestartableService(
- "mojo:browser_driver",
- base::Bind(&ShellApplicationDelegate::StartBrowserDriver,
- base::Unretained(this)));
-}
-
-void ShellApplicationDelegate::StartQuickLaunch() {
- StartRestartableService(
- "mojo:quick_launch",
- base::Bind(&ShellApplicationDelegate::StartQuickLaunch,
- base::Unretained(this)));
-}
-
-void ShellApplicationDelegate::StartScreenlock() {
- StartRestartableService(
- "mojo:screenlock",
- base::Bind(&ShellApplicationDelegate::StartScreenlock,
- base::Unretained(this)));
-}
-
-void ShellApplicationDelegate::StopScreenlock() {
- auto connection = connections_.find("mojo:screenlock");
- DCHECK(connections_.end() != connection);
- connections_.erase(connection);
-}
-
-void ShellApplicationDelegate::StartRestartableService(
- const std::string& url,
- const base::Closure& restart_callback) {
- // TODO(beng): This would be the place to insert logic that counted restarts
- // to avoid infinite crash-restart loops.
- scoped_ptr<mojo::Connection> connection = connector_->Connect(url);
- // Note: |connection| may be null if we've lost our connection to the shell.
- if (connection) {
- connection->SetConnectionLostClosure(restart_callback);
- connection->AddInterface<mojom::Shell>(this);
- connections_[url] = std::move(connection);
- }
-}
-
-} // namespace shell
-} // namespace main
« no previous file with comments | « mash/shell/shell_application_delegate.h ('k') | mash/wm/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698