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

Unified Diff: mash/shell/shell_application_delegate.cc

Issue 1637113003: Add simplistic screenlock application. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 11 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
index 6672295c3b909da5fe1c7168782134a485ee457f..30a59191629fb4a35ffbc38b4bea2cb712fd6edc 100644
--- a/mash/shell/shell_application_delegate.cc
+++ b/mash/shell/shell_application_delegate.cc
@@ -5,6 +5,7 @@
#include "mash/shell/shell_application_delegate.h"
#include "base/bind.h"
+#include "mash/screenlock/public/interfaces/screenlock.mojom.h"
#include "mojo/shell/public/cpp/application_connection.h"
#include "mojo/shell/public/cpp/application_impl.h"
@@ -26,7 +27,21 @@ void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
bool ShellApplicationDelegate::ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) {
- return false;
+ connection->AddService<mash::shell::mojom::Shell>(this);
+ return true;
+}
+
+void ShellApplicationDelegate::LockScreen() {
+ StartScreenlock();
+}
+void ShellApplicationDelegate::UnlockScreen() {
+ StopScreenlock();
+}
+
+void ShellApplicationDelegate::Create(
+ mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<mash::shell::mojom::Shell> r) {
+ bindings_.AddBinding(this, std::move(r));
}
void ShellApplicationDelegate::StartWindowManager() {
@@ -62,6 +77,22 @@ void 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);
+ mash::screenlock::mojom::ScreenlockPtr screenlock;
+ connection->second->ConnectToService(&screenlock);
+ screenlock->Quit();
+ connections_.erase(connection);
+}
+
void ShellApplicationDelegate::StartRestartableService(
const std::string& url,
const base::Closure& restart_callback) {
« 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