OLD | NEW |
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 "mojo/shell/public/cpp/application_connection.h" | 8 #include "mojo/shell/public/cpp/application_connection.h" |
9 #include "mojo/shell/public/cpp/application_impl.h" | 9 #include "mojo/shell/public/cpp/application_impl.h" |
10 | 10 |
11 namespace mash { | 11 namespace mash { |
12 namespace shell { | 12 namespace shell { |
13 | 13 |
14 ShellApplicationDelegate::ShellApplicationDelegate() | 14 ShellApplicationDelegate::ShellApplicationDelegate() |
15 : app_(nullptr), screen_locked_(false) {} | 15 : app_(nullptr), screen_locked_(false) {} |
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::AddScreenlockStateListener( | 38 void ShellApplicationDelegate::AddScreenlockStateListener( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 base::Unretained(this))); | 94 base::Unretained(this))); |
91 } | 95 } |
92 | 96 |
93 void ShellApplicationDelegate::StartQuickLaunch() { | 97 void ShellApplicationDelegate::StartQuickLaunch() { |
94 StartRestartableService( | 98 StartRestartableService( |
95 "mojo:quick_launch", | 99 "mojo:quick_launch", |
96 base::Bind(&ShellApplicationDelegate::StartQuickLaunch, | 100 base::Bind(&ShellApplicationDelegate::StartQuickLaunch, |
97 base::Unretained(this))); | 101 base::Unretained(this))); |
98 } | 102 } |
99 | 103 |
| 104 void ShellApplicationDelegate::StartSysUI() { |
| 105 StartRestartableService("mojo:ash_sysui", |
| 106 base::Bind(&ShellApplicationDelegate::StartSysUI, |
| 107 base::Unretained(this))); |
| 108 } |
| 109 |
100 void ShellApplicationDelegate::StartScreenlock() { | 110 void ShellApplicationDelegate::StartScreenlock() { |
101 StartRestartableService( | 111 StartRestartableService( |
102 "mojo:screenlock", | 112 "mojo:screenlock", |
103 base::Bind(&ShellApplicationDelegate::StartScreenlock, | 113 base::Bind(&ShellApplicationDelegate::StartScreenlock, |
104 base::Unretained(this))); | 114 base::Unretained(this))); |
105 } | 115 } |
106 | 116 |
107 void ShellApplicationDelegate::StopScreenlock() { | 117 void ShellApplicationDelegate::StopScreenlock() { |
108 auto connection = connections_.find("mojo:screenlock"); | 118 auto connection = connections_.find("mojo:screenlock"); |
109 DCHECK(connections_.end() != connection); | 119 DCHECK(connections_.end() != connection); |
110 connections_.erase(connection); | 120 connections_.erase(connection); |
111 } | 121 } |
112 | 122 |
113 void ShellApplicationDelegate::StartRestartableService( | 123 void ShellApplicationDelegate::StartRestartableService( |
114 const std::string& url, | 124 const std::string& url, |
115 const base::Closure& restart_callback) { | 125 const base::Closure& restart_callback) { |
116 // TODO(beng): This would be the place to insert logic that counted restarts | 126 // TODO(beng): This would be the place to insert logic that counted restarts |
117 // to avoid infinite crash-restart loops. | 127 // to avoid infinite crash-restart loops. |
118 scoped_ptr<mojo::ApplicationConnection> connection = | 128 scoped_ptr<mojo::ApplicationConnection> connection = |
119 app_->ConnectToApplication(url); | 129 app_->ConnectToApplication(url); |
120 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); | 130 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); |
121 connections_[url] = std::move(connection); | 131 connections_[url] = std::move(connection); |
122 } | 132 } |
123 | 133 |
124 } // namespace shell | 134 } // namespace shell |
125 } // namespace main | 135 } // namespace main |
OLD | NEW |