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/application/public/cpp/application_connection.h" | 8 #include "mojo/application/public/cpp/application_connection.h" |
9 #include "mojo/application/public/cpp/application_impl.h" | 9 #include "mojo/application/public/cpp/application_impl.h" |
10 | 10 |
11 namespace mash { | 11 namespace mash { |
12 namespace shell { | 12 namespace shell { |
13 | 13 |
14 ShellApplicationDelegate::ShellApplicationDelegate() : app_(nullptr) {} | 14 ShellApplicationDelegate::ShellApplicationDelegate() : app_(nullptr) {} |
15 | 15 |
16 ShellApplicationDelegate::~ShellApplicationDelegate() {} | 16 ShellApplicationDelegate::~ShellApplicationDelegate() {} |
17 | 17 |
18 void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { | 18 void ShellApplicationDelegate::Initialize(mojo::ApplicationImpl* app) { |
19 app_ = app; | 19 app_ = app; |
20 StartBrowserDriver(); | 20 StartBrowserDriver(); |
21 StartWindowManager(); | 21 StartWindowManager(); |
22 StartSystemUI(); | 22 StartSystemUI(); |
| 23 StartQuickLaunch(); |
23 } | 24 } |
24 | 25 |
25 bool ShellApplicationDelegate::ConfigureIncomingConnection( | 26 bool ShellApplicationDelegate::ConfigureIncomingConnection( |
26 mojo::ApplicationConnection* connection) { | 27 mojo::ApplicationConnection* connection) { |
27 return false; | 28 return false; |
28 } | 29 } |
29 | 30 |
30 void ShellApplicationDelegate::StartWindowManager() { | 31 void ShellApplicationDelegate::StartWindowManager() { |
31 StartRestartableService( | 32 StartRestartableService( |
32 "mojo:desktop_wm", | 33 "mojo:desktop_wm", |
33 base::Bind(&ShellApplicationDelegate::StartWindowManager, | 34 base::Bind(&ShellApplicationDelegate::StartWindowManager, |
34 base::Unretained(this))); | 35 base::Unretained(this))); |
35 } | 36 } |
36 | 37 |
37 void ShellApplicationDelegate::StartSystemUI() { | 38 void ShellApplicationDelegate::StartSystemUI() { |
38 StartRestartableService("mojo:system_ui", | 39 StartRestartableService("mojo:system_ui", |
39 base::Bind(&ShellApplicationDelegate::StartSystemUI, | 40 base::Bind(&ShellApplicationDelegate::StartSystemUI, |
40 base::Unretained(this))); | 41 base::Unretained(this))); |
41 } | 42 } |
42 | 43 |
43 void ShellApplicationDelegate::StartBrowserDriver() { | 44 void ShellApplicationDelegate::StartBrowserDriver() { |
44 StartRestartableService( | 45 StartRestartableService( |
45 "mojo:browser_driver", | 46 "mojo:browser_driver", |
46 base::Bind(&ShellApplicationDelegate::StartBrowserDriver, | 47 base::Bind(&ShellApplicationDelegate::StartBrowserDriver, |
47 base::Unretained(this))); | 48 base::Unretained(this))); |
48 } | 49 } |
49 | 50 |
| 51 void ShellApplicationDelegate::StartQuickLaunch() { |
| 52 StartRestartableService( |
| 53 "mojo:quick_launch", |
| 54 base::Bind(&ShellApplicationDelegate::StartQuickLaunch, |
| 55 base::Unretained(this))); |
| 56 } |
| 57 |
50 void ShellApplicationDelegate::StartRestartableService( | 58 void ShellApplicationDelegate::StartRestartableService( |
51 const std::string& url, | 59 const std::string& url, |
52 const base::Closure& restart_callback) { | 60 const base::Closure& restart_callback) { |
53 // TODO(beng): This would be the place to insert logic that counted restarts | 61 // TODO(beng): This would be the place to insert logic that counted restarts |
54 // to avoid infinite crash-restart loops. | 62 // to avoid infinite crash-restart loops. |
55 scoped_ptr<mojo::ApplicationConnection> connection = | 63 scoped_ptr<mojo::ApplicationConnection> connection = |
56 app_->ConnectToApplication(url); | 64 app_->ConnectToApplication(url); |
57 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); | 65 connection->SetRemoteServiceProviderConnectionErrorHandler(restart_callback); |
58 connections_[url] = std::move(connection); | 66 connections_[url] = std::move(connection); |
59 } | 67 } |
60 | 68 |
61 } // namespace shell | 69 } // namespace shell |
62 } // namespace main | 70 } // namespace main |
OLD | NEW |