OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/quick_launch/quick_launch.h" | 5 #include "mash/quick_launch/quick_launch.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 void QuickLaunch::RemoveWindow(views::Widget* window) { | 165 void QuickLaunch::RemoveWindow(views::Widget* window) { |
166 auto it = std::find(windows_.begin(), windows_.end(), window); | 166 auto it = std::find(windows_.begin(), windows_.end(), window); |
167 DCHECK(it != windows_.end()); | 167 DCHECK(it != windows_.end()); |
168 windows_.erase(it); | 168 windows_.erase(it); |
169 if (windows_.empty() && base::RunLoop::IsRunningOnCurrentThread()) | 169 if (windows_.empty() && base::RunLoop::IsRunningOnCurrentThread()) |
170 base::MessageLoop::current()->QuitWhenIdle(); | 170 base::MessageLoop::current()->QuitWhenIdle(); |
171 } | 171 } |
172 | 172 |
173 void QuickLaunch::OnStart() { | 173 void QuickLaunch::OnStart() { |
| 174 aura_init_ = base::MakeUnique<views::AuraInit>( |
| 175 context()->connector(), context()->identity(), "views_mus_resources.pak", |
| 176 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); |
| 177 |
174 // If AuraInit was unable to initialize there is no longer a peer connection. | 178 // If AuraInit was unable to initialize there is no longer a peer connection. |
175 // The ServiceManager is in the process of shutting down, however we haven't | 179 // The ServiceManager is in the process of shutting down, however we haven't |
176 // been notified yet. Close our ServiceContext and shutdown. | 180 // been notified yet. Close our ServiceContext and shutdown. |
177 aura_init_ = views::AuraInit::Create( | 181 if (!aura_init_->initialized()) { |
178 context()->connector(), context()->identity(), "views_mus_resources.pak", | |
179 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); | |
180 if (!aura_init_) { | |
181 context()->QuitNow(); | 182 context()->QuitNow(); |
182 return; | 183 return; |
183 } | 184 } |
184 | 185 |
185 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); | 186 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); |
186 } | 187 } |
187 | 188 |
188 void QuickLaunch::OnBindInterface( | 189 void QuickLaunch::OnBindInterface( |
189 const service_manager::BindSourceInfo& source_info, | 190 const service_manager::BindSourceInfo& source_info, |
190 const std::string& interface_name, | 191 const std::string& interface_name, |
(...skipping 20 matching lines...) Expand all Loading... |
211 windows_.push_back(window); | 212 windows_.push_back(window); |
212 } | 213 } |
213 | 214 |
214 void QuickLaunch::Create(const service_manager::BindSourceInfo& source_info, | 215 void QuickLaunch::Create(const service_manager::BindSourceInfo& source_info, |
215 ::mash::mojom::LaunchableRequest request) { | 216 ::mash::mojom::LaunchableRequest request) { |
216 bindings_.AddBinding(this, std::move(request)); | 217 bindings_.AddBinding(this, std::move(request)); |
217 } | 218 } |
218 | 219 |
219 } // namespace quick_launch | 220 } // namespace quick_launch |
220 } // namespace mash | 221 } // namespace mash |
OLD | NEW |