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 | |
178 // If AuraInit was unable to initialize there is no longer a peer connection. | 174 // If AuraInit was unable to initialize there is no longer a peer connection. |
179 // The ServiceManager is in the process of shutting down, however we haven't | 175 // The ServiceManager is in the process of shutting down, however we haven't |
180 // been notified yet. Close our ServiceContext and shutdown. | 176 // been notified yet. Close our ServiceContext and shutdown. |
181 if (!aura_init_->initialized()) { | 177 aura_init_ = views::AuraInit::Create( |
| 178 context()->connector(), context()->identity(), "views_mus_resources.pak", |
| 179 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); |
| 180 if (!aura_init_) { |
182 context()->QuitNow(); | 181 context()->QuitNow(); |
183 return; | 182 return; |
184 } | 183 } |
185 | 184 |
186 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); | 185 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); |
187 } | 186 } |
188 | 187 |
189 void QuickLaunch::OnBindInterface( | 188 void QuickLaunch::OnBindInterface( |
190 const service_manager::BindSourceInfo& source_info, | 189 const service_manager::BindSourceInfo& source_info, |
191 const std::string& interface_name, | 190 const std::string& interface_name, |
(...skipping 20 matching lines...) Expand all Loading... |
212 windows_.push_back(window); | 211 windows_.push_back(window); |
213 } | 212 } |
214 | 213 |
215 void QuickLaunch::Create(const service_manager::BindSourceInfo& source_info, | 214 void QuickLaunch::Create(const service_manager::BindSourceInfo& source_info, |
216 ::mash::mojom::LaunchableRequest request) { | 215 ::mash::mojom::LaunchableRequest request) { |
217 bindings_.AddBinding(this, std::move(request)); | 216 bindings_.AddBinding(this, std::move(request)); |
218 } | 217 } |
219 | 218 |
220 } // namespace quick_launch | 219 } // namespace quick_launch |
221 } // namespace mash | 220 } // namespace mash |
OLD | NEW |