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/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "mash/public/interfaces/launchable.mojom.h" | 13 #include "mash/public/interfaces/launchable.mojom.h" |
14 #include "services/catalog/public/interfaces/catalog.mojom.h" | 14 #include "services/catalog/public/interfaces/catalog.mojom.h" |
15 #include "services/catalog/public/interfaces/constants.mojom.h" | 15 #include "services/catalog/public/interfaces/constants.mojom.h" |
16 #include "services/service_manager/public/c/main.h" | 16 #include "services/service_manager/public/c/main.h" |
17 #include "services/service_manager/public/cpp/connector.h" | 17 #include "services/service_manager/public/cpp/connector.h" |
18 #include "services/service_manager/public/cpp/service.h" | 18 #include "services/service_manager/public/cpp/service.h" |
19 #include "services/service_manager/public/cpp/service_context.h" | 19 #include "services/service_manager/public/cpp/service_context.h" |
20 #include "services/service_manager/public/cpp/service_runner.h" | 20 #include "services/service_manager/public/cpp/service_runner.h" |
21 #include "services/tracing/public/cpp/provider.h" | |
22 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
23 #include "ui/aura/window_tree_host.h" | 22 #include "ui/aura/window_tree_host.h" |
24 #include "ui/views/background.h" | 23 #include "ui/views/background.h" |
25 #include "ui/views/controls/textfield/textfield.h" | 24 #include "ui/views/controls/textfield/textfield.h" |
26 #include "ui/views/controls/textfield/textfield_controller.h" | 25 #include "ui/views/controls/textfield/textfield_controller.h" |
27 #include "ui/views/mus/aura_init.h" | 26 #include "ui/views/mus/aura_init.h" |
28 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
29 #include "ui/views/widget/widget_delegate.h" | 28 #include "ui/views/widget/widget_delegate.h" |
30 #include "url/gurl.h" | 29 #include "url/gurl.h" |
31 | 30 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 162 |
164 void QuickLaunch::RemoveWindow(views::Widget* window) { | 163 void QuickLaunch::RemoveWindow(views::Widget* window) { |
165 auto it = std::find(windows_.begin(), windows_.end(), window); | 164 auto it = std::find(windows_.begin(), windows_.end(), window); |
166 DCHECK(it != windows_.end()); | 165 DCHECK(it != windows_.end()); |
167 windows_.erase(it); | 166 windows_.erase(it); |
168 if (windows_.empty() && base::MessageLoop::current()->is_running()) | 167 if (windows_.empty() && base::MessageLoop::current()->is_running()) |
169 base::MessageLoop::current()->QuitWhenIdle(); | 168 base::MessageLoop::current()->QuitWhenIdle(); |
170 } | 169 } |
171 | 170 |
172 void QuickLaunch::OnStart() { | 171 void QuickLaunch::OnStart() { |
173 tracing_.Initialize(context()->connector(), context()->identity().name()); | |
174 | |
175 aura_init_ = base::MakeUnique<views::AuraInit>( | 172 aura_init_ = base::MakeUnique<views::AuraInit>( |
176 context()->connector(), context()->identity(), "views_mus_resources.pak", | 173 context()->connector(), context()->identity(), "views_mus_resources.pak", |
177 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); | 174 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); |
178 | 175 |
179 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); | 176 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); |
180 } | 177 } |
181 | 178 |
182 void QuickLaunch::OnBindInterface( | 179 void QuickLaunch::OnBindInterface( |
183 const service_manager::ServiceInfo& source_info, | 180 const service_manager::ServiceInfo& source_info, |
184 const std::string& interface_name, | 181 const std::string& interface_name, |
(...skipping 20 matching lines...) Expand all Loading... |
205 windows_.push_back(window); | 202 windows_.push_back(window); |
206 } | 203 } |
207 | 204 |
208 void QuickLaunch::Create(const service_manager::Identity& remote_identity, | 205 void QuickLaunch::Create(const service_manager::Identity& remote_identity, |
209 ::mash::mojom::LaunchableRequest request) { | 206 ::mash::mojom::LaunchableRequest request) { |
210 bindings_.AddBinding(this, std::move(request)); | 207 bindings_.AddBinding(this, std::move(request)); |
211 } | 208 } |
212 | 209 |
213 } // namespace quick_launch | 210 } // namespace quick_launch |
214 } // namespace mash | 211 } // namespace mash |
OLD | NEW |