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

Side by Side Diff: mash/shell/shell_application_delegate.cc

Issue 1645503004: [exp] ash: sysui for mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ash-in-mus
Patch Set: . Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mash/shell/shell_application_delegate.h" 5 #include "mash/shell/shell_application_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "mash/screenlock/public/interfaces/screenlock.mojom.h" 8 #include "mash/screenlock/public/interfaces/screenlock.mojom.h"
9 #include "mojo/shell/public/cpp/application_connection.h" 9 #include "mojo/shell/public/cpp/application_connection.h"
10 #include "mojo/shell/public/cpp/application_impl.h" 10 #include "mojo/shell/public/cpp/application_impl.h"
11 11
12 namespace mash { 12 namespace mash {
13 namespace shell { 13 namespace shell {
14 14
15 ShellApplicationDelegate::ShellApplicationDelegate() : app_(nullptr) {} 15 ShellApplicationDelegate::ShellApplicationDelegate() : app_(nullptr) {}
16 16
17 ShellApplicationDelegate::~ShellApplicationDelegate() {} 17 ShellApplicationDelegate::~ShellApplicationDelegate() {}
18 18
19 void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { 19 void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) {
20 app_ = app; 20 app_ = app;
21 StartBrowserDriver(); 21 StartBrowserDriver();
22 StartWindowManager(); 22 StartWindowManager();
23 #if 0
23 StartWallpaper(); 24 StartWallpaper();
24 StartShelf(); 25 StartShelf();
26 #else
27 StartSysUI();
28 #endif
25 StartQuickLaunch(); 29 StartQuickLaunch();
26 } 30 }
27 31
28 bool ShellApplicationDelegate::ConfigureIncomingConnection( 32 bool ShellApplicationDelegate::ConfigureIncomingConnection(
29 mojo::ApplicationConnection* connection) { 33 mojo::ApplicationConnection* connection) {
30 connection->AddService<mash::shell::mojom::Shell>(this); 34 connection->AddService<mash::shell::mojom::Shell>(this);
31 return true; 35 return true;
32 } 36 }
33 37
34 void ShellApplicationDelegate::LockScreen() { 38 void ShellApplicationDelegate::LockScreen() {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 base::Unretained(this))); 74 base::Unretained(this)));
71 } 75 }
72 76
73 void ShellApplicationDelegate::StartQuickLaunch() { 77 void ShellApplicationDelegate::StartQuickLaunch() {
74 StartRestartableService( 78 StartRestartableService(
75 "mojo:quick_launch", 79 "mojo:quick_launch",
76 base::Bind(&ShellApplicationDelegate::StartQuickLaunch, 80 base::Bind(&ShellApplicationDelegate::StartQuickLaunch,
77 base::Unretained(this))); 81 base::Unretained(this)));
78 } 82 }
79 83
84 void ShellApplicationDelegate::StartSysUI() {
85 StartRestartableService("mojo:ash_sysui",
86 base::Bind(&ShellApplicationDelegate::StartSysUI,
87 base::Unretained(this)));
88 }
89
80 void ShellApplicationDelegate::StartScreenlock() { 90 void ShellApplicationDelegate::StartScreenlock() {
81 StartRestartableService( 91 StartRestartableService(
82 "mojo:screenlock", 92 "mojo:screenlock",
83 base::Bind(&ShellApplicationDelegate::StartScreenlock, 93 base::Bind(&ShellApplicationDelegate::StartScreenlock,
84 base::Unretained(this))); 94 base::Unretained(this)));
85 } 95 }
86 96
87 void ShellApplicationDelegate::StopScreenlock() { 97 void ShellApplicationDelegate::StopScreenlock() {
88 auto connection = connections_.find("mojo:screenlock"); 98 auto connection = connections_.find("mojo:screenlock");
89 DCHECK(connections_.end() != connection); 99 DCHECK(connections_.end() != connection);
90 mash::screenlock::mojom::ScreenlockPtr screenlock; 100 mash::screenlock::mojom::ScreenlockPtr screenlock;
91 connection->second->ConnectToService(&screenlock); 101 connection->second->ConnectToService(&screenlock);
92 screenlock->Quit(); 102 screenlock->Quit();
93 connections_.erase(connection); 103 connections_.erase(connection);
94 } 104 }
95 105
96 void ShellApplicationDelegate::StartRestartableService( 106 void ShellApplicationDelegate::StartRestartableService(
97 const std::string& url, 107 const std::string& url,
98 const base::Closure& restart_callback) { 108 const base::Closure& restart_callback) {
99 // TODO(beng): This would be the place to insert logic that counted restarts 109 // TODO(beng): This would be the place to insert logic that counted restarts
100 // to avoid infinite crash-restart loops. 110 // to avoid infinite crash-restart loops.
101 scoped_ptr<mojo::ApplicationConnection> connection = 111 scoped_ptr<mojo::ApplicationConnection> connection =
102 app_->ConnectToApplication(url); 112 app_->ConnectToApplication(url);
103 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); 113 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback);
104 connections_[url] = std::move(connection); 114 connections_[url] = std::move(connection);
105 } 115 }
106 116
107 } // namespace shell 117 } // namespace shell
108 } // namespace main 118 } // namespace main
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698