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 "base/command_line.h" |
8 #include "mojo/shell/public/cpp/connection.h" | 9 #include "mojo/shell/public/cpp/connection.h" |
9 #include "mojo/shell/public/cpp/shell.h" | 10 #include "mojo/shell/public/cpp/shell.h" |
10 | 11 |
| 12 namespace { |
| 13 |
| 14 const char kUseAshSysui[] = "use-ash-sysui"; |
| 15 |
| 16 } // namespace |
| 17 |
11 namespace mash { | 18 namespace mash { |
12 namespace shell { | 19 namespace shell { |
13 | 20 |
14 ShellApplicationDelegate::ShellApplicationDelegate() | 21 ShellApplicationDelegate::ShellApplicationDelegate() |
15 : shell_(nullptr), screen_locked_(false) {} | 22 : shell_(nullptr), screen_locked_(false) {} |
16 | 23 |
17 ShellApplicationDelegate::~ShellApplicationDelegate() {} | 24 ShellApplicationDelegate::~ShellApplicationDelegate() {} |
18 | 25 |
19 void ShellApplicationDelegate::Initialize(mojo::Shell* shell, | 26 void ShellApplicationDelegate::Initialize(mojo::Shell* shell, |
20 const std::string& url, | 27 const std::string& url, |
21 uint32_t id) { | 28 uint32_t id) { |
22 shell_ = shell; | 29 shell_ = shell; |
23 StartBrowserDriver(); | 30 StartBrowserDriver(); |
24 StartWindowManager(); | 31 StartWindowManager(); |
25 StartWallpaper(); | 32 StartSystemUI(); |
26 StartShelf(); | |
27 StartQuickLaunch(); | 33 StartQuickLaunch(); |
28 } | 34 } |
29 | 35 |
30 bool ShellApplicationDelegate::AcceptConnection(mojo::Connection* connection) { | 36 bool ShellApplicationDelegate::AcceptConnection(mojo::Connection* connection) { |
31 connection->AddInterface<mash::shell::mojom::Shell>(this); | 37 connection->AddInterface<mash::shell::mojom::Shell>(this); |
32 return true; | 38 return true; |
33 } | 39 } |
34 | 40 |
35 void ShellApplicationDelegate::AddScreenlockStateListener( | 41 void ShellApplicationDelegate::AddScreenlockStateListener( |
36 mojom::ScreenlockStateListenerPtr listener) { | 42 mojom::ScreenlockStateListenerPtr listener) { |
(...skipping 28 matching lines...) Expand all Loading... |
65 bindings_.AddBinding(this, std::move(r)); | 71 bindings_.AddBinding(this, std::move(r)); |
66 } | 72 } |
67 | 73 |
68 void ShellApplicationDelegate::StartWindowManager() { | 74 void ShellApplicationDelegate::StartWindowManager() { |
69 StartRestartableService( | 75 StartRestartableService( |
70 "mojo:desktop_wm", | 76 "mojo:desktop_wm", |
71 base::Bind(&ShellApplicationDelegate::StartWindowManager, | 77 base::Bind(&ShellApplicationDelegate::StartWindowManager, |
72 base::Unretained(this))); | 78 base::Unretained(this))); |
73 } | 79 } |
74 | 80 |
| 81 void ShellApplicationDelegate::StartSystemUI() { |
| 82 static bool use_ash = |
| 83 base::CommandLine::ForCurrentProcess()->HasSwitch(kUseAshSysui); |
| 84 if (use_ash) { |
| 85 StartRestartableService("mojo:ash_sysui", |
| 86 base::Bind(&ShellApplicationDelegate::StartSystemUI, |
| 87 base::Unretained(this))); |
| 88 } else { |
| 89 StartWallpaper(); |
| 90 StartShelf(); |
| 91 } |
| 92 } |
| 93 |
75 void ShellApplicationDelegate::StartWallpaper() { | 94 void ShellApplicationDelegate::StartWallpaper() { |
76 StartRestartableService("mojo:wallpaper", | 95 StartRestartableService("mojo:wallpaper", |
77 base::Bind(&ShellApplicationDelegate::StartWallpaper, | 96 base::Bind(&ShellApplicationDelegate::StartWallpaper, |
78 base::Unretained(this))); | 97 base::Unretained(this))); |
79 } | 98 } |
80 | 99 |
81 void ShellApplicationDelegate::StartShelf() { | 100 void ShellApplicationDelegate::StartShelf() { |
82 StartRestartableService("mojo:shelf", | 101 StartRestartableService("mojo:shelf", |
83 base::Bind(&ShellApplicationDelegate::StartShelf, | 102 base::Bind(&ShellApplicationDelegate::StartShelf, |
84 base::Unretained(this))); | 103 base::Unretained(this))); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Note: |connection| may be null if we've lost our connection to the shell. | 139 // Note: |connection| may be null if we've lost our connection to the shell. |
121 if (connection) { | 140 if (connection) { |
122 connection->SetRemoteServiceProviderConnectionErrorHandler( | 141 connection->SetRemoteServiceProviderConnectionErrorHandler( |
123 restart_callback); | 142 restart_callback); |
124 connections_[url] = std::move(connection); | 143 connections_[url] = std::move(connection); |
125 } | 144 } |
126 } | 145 } |
127 | 146 |
128 } // namespace shell | 147 } // namespace shell |
129 } // namespace main | 148 } // namespace main |
OLD | NEW |