| 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/interface_registry.h" | 18 #include "services/service_manager/public/cpp/interface_registry.h" |
| 19 #include "services/service_manager/public/cpp/service.h" | 19 #include "services/service_manager/public/cpp/service.h" |
| 20 #include "services/service_manager/public/cpp/service_context.h" | 20 #include "services/service_manager/public/cpp/service_context.h" |
| 21 #include "services/service_manager/public/cpp/service_runner.h" | 21 #include "services/service_manager/public/cpp/service_runner.h" |
| 22 #include "services/tracing/public/cpp/provider.h" | 22 #include "services/tracing/public/cpp/provider.h" |
| 23 #include "ui/views/background.h" | 23 #include "ui/views/background.h" |
| 24 #include "ui/views/controls/textfield/textfield.h" | 24 #include "ui/views/controls/textfield/textfield.h" |
| 25 #include "ui/views/controls/textfield/textfield_controller.h" | 25 #include "ui/views/controls/textfield/textfield_controller.h" |
| 26 #include "ui/views/mus/aura_init.h" | 26 #include "ui/views/mus/aura_init.h" |
| 27 #include "ui/views/mus/window_manager_connection.h" | 27 #include "ui/views/widget/widget.h" |
| 28 #include "ui/views/widget/widget_delegate.h" | 28 #include "ui/views/widget/widget_delegate.h" |
| 29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
| 30 | 30 |
| 31 namespace views { | |
| 32 class AuraInit; | |
| 33 } | |
| 34 | |
| 35 namespace mash { | 31 namespace mash { |
| 36 namespace quick_launch { | 32 namespace quick_launch { |
| 37 | 33 |
| 38 class QuickLaunchUI : public views::WidgetDelegateView, | 34 class QuickLaunchUI : public views::WidgetDelegateView, |
| 39 public views::TextfieldController { | 35 public views::TextfieldController { |
| 40 public: | 36 public: |
| 41 QuickLaunchUI(QuickLaunch* quick_launch, | 37 QuickLaunchUI(QuickLaunch* quick_launch, |
| 42 service_manager::Connector* connector, | 38 service_manager::Connector* connector, |
| 43 catalog::mojom::CatalogPtr catalog) | 39 catalog::mojom::CatalogPtr catalog) |
| 44 : quick_launch_(quick_launch), | 40 : quick_launch_(quick_launch), |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 DCHECK(it != windows_.end()); | 163 DCHECK(it != windows_.end()); |
| 168 windows_.erase(it); | 164 windows_.erase(it); |
| 169 if (windows_.empty() && base::MessageLoop::current()->is_running()) | 165 if (windows_.empty() && base::MessageLoop::current()->is_running()) |
| 170 base::MessageLoop::current()->QuitWhenIdle(); | 166 base::MessageLoop::current()->QuitWhenIdle(); |
| 171 } | 167 } |
| 172 | 168 |
| 173 void QuickLaunch::OnStart() { | 169 void QuickLaunch::OnStart() { |
| 174 tracing_.Initialize(context()->connector(), context()->identity().name()); | 170 tracing_.Initialize(context()->connector(), context()->identity().name()); |
| 175 | 171 |
| 176 aura_init_ = base::MakeUnique<views::AuraInit>( | 172 aura_init_ = base::MakeUnique<views::AuraInit>( |
| 177 context()->connector(), context()->identity(), "views_mus_resources.pak"); | 173 context()->connector(), context()->identity(), "views_mus_resources.pak", |
| 178 window_manager_connection_ = views::WindowManagerConnection::Create( | 174 std::string(), nullptr, views::AuraInit::Mode::AURA_MUS); |
| 179 context()->connector(), context()->identity()); | |
| 180 | 175 |
| 181 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); | 176 Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW); |
| 182 } | 177 } |
| 183 | 178 |
| 184 bool QuickLaunch::OnConnect(const service_manager::ServiceInfo& remote_info, | 179 bool QuickLaunch::OnConnect(const service_manager::ServiceInfo& remote_info, |
| 185 service_manager::InterfaceRegistry* registry) { | 180 service_manager::InterfaceRegistry* registry) { |
| 186 registry->AddInterface<::mash::mojom::Launchable>(this); | 181 registry->AddInterface<::mash::mojom::Launchable>(this); |
| 187 return true; | 182 return true; |
| 188 } | 183 } |
| 189 | 184 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 205 windows_.push_back(window); | 200 windows_.push_back(window); |
| 206 } | 201 } |
| 207 | 202 |
| 208 void QuickLaunch::Create(const service_manager::Identity& remote_identity, | 203 void QuickLaunch::Create(const service_manager::Identity& remote_identity, |
| 209 ::mash::mojom::LaunchableRequest request) { | 204 ::mash::mojom::LaunchableRequest request) { |
| 210 bindings_.AddBinding(this, std::move(request)); | 205 bindings_.AddBinding(this, std::move(request)); |
| 211 } | 206 } |
| 212 | 207 |
| 213 } // namespace quick_launch | 208 } // namespace quick_launch |
| 214 } // namespace mash | 209 } // namespace mash |
| OLD | NEW |