diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 81a536a3c9db39..9079d674d573a1 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn @@ -1144,7 +1144,7 @@ component("ash") { data_deps = [ "//ash/components/autoclick:autoclick_app", - "//ash/touch_hud/mus:touch_hud", + "//ash/components/touch_hud:touch_hud_app", ] # Usage of content should be in ash_content_unittests. diff --git a/ash/touch_hud/mus/BUILD.gn b/ash/components/touch_hud/BUILD.gn similarity index 95% rename from ash/touch_hud/mus/BUILD.gn rename to ash/components/touch_hud/BUILD.gn index d0163c839559d9..a329ef2d7e1d2d 100644 --- a/ash/touch_hud/mus/BUILD.gn +++ b/ash/components/touch_hud/BUILD.gn @@ -28,7 +28,7 @@ source_set("lib") { ] } -service("touch_hud") { +service("touch_hud_app") { sources = [ "main.cc", ] @@ -45,6 +45,6 @@ service("touch_hud") { } service_manifest("manifest") { - name = "touch_hud" + name = "touch_hud_app" source = "manifest.json" } diff --git a/ash/touch_hud/mus/DEPS b/ash/components/touch_hud/DEPS similarity index 80% rename from ash/touch_hud/mus/DEPS rename to ash/components/touch_hud/DEPS index 66ba586cf218d6..0042293b518f95 100644 --- a/ash/touch_hud/mus/DEPS +++ b/ash/components/touch_hud/DEPS @@ -1,9 +1,11 @@ include_rules = [ - "-ash", "+ash/public", "+ash/touch_hud", + "+base", "+mash/public/mojom", "+mojo/public", "+services/service_manager/public", "+services/ui/public", + "+ui/aura", + "+ui/views", ] diff --git a/ash/touch_hud/mus/OWNERS b/ash/components/touch_hud/OWNERS similarity index 100% rename from ash/touch_hud/mus/OWNERS rename to ash/components/touch_hud/OWNERS diff --git a/ash/touch_hud/mus/main.cc b/ash/components/touch_hud/main.cc similarity index 76% rename from ash/touch_hud/mus/main.cc rename to ash/components/touch_hud/main.cc index c220cff1dad8b3..3acb4dcc35f8e5 100644 --- a/ash/touch_hud/mus/main.cc +++ b/ash/components/touch_hud/main.cc @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/touch_hud/mus/touch_hud_application.h" +#include "ash/components/touch_hud/touch_hud_application.h" #include "services/service_manager/public/c/main.h" #include "services/service_manager/public/cpp/service_runner.h" MojoResult ServiceMain(MojoHandle service_request_handle) { - ash::touch_hud::TouchHudApplication* app = - new ash::touch_hud::TouchHudApplication; + touch_hud::TouchHudApplication* app = new touch_hud::TouchHudApplication; app->set_running_standalone(true); service_manager::ServiceRunner runner(app); return runner.Run(service_request_handle); diff --git a/ash/touch_hud/mus/manifest.json b/ash/components/touch_hud/manifest.json similarity index 92% rename from ash/touch_hud/mus/manifest.json rename to ash/components/touch_hud/manifest.json index ab4a19dc873a16..062eaeaf6b238e 100644 --- a/ash/touch_hud/mus/manifest.json +++ b/ash/components/touch_hud/manifest.json @@ -1,5 +1,5 @@ { - "name": "touch_hud", + "name": "touch_hud_app", "display_name": "Touch Hud", "sandbox_type": "none", "interface_provider_specs": { diff --git a/ash/touch_hud/mus/touch_hud_application.cc b/ash/components/touch_hud/touch_hud_application.cc similarity index 88% rename from ash/touch_hud/mus/touch_hud_application.cc rename to ash/components/touch_hud/touch_hud_application.cc index 1297d56a53daa3..a0f00404ac6006 100644 --- a/ash/touch_hud/mus/touch_hud_application.cc +++ b/ash/components/touch_hud/touch_hud_application.cc @@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/touch_hud/mus/touch_hud_application.h" +#include "ash/components/touch_hud/touch_hud_application.h" #include #include "ash/public/cpp/shell_window_ids.h" #include "ash/touch_hud/touch_hud_renderer.h" #include "base/macros.h" -#include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/service_context.h" @@ -23,7 +22,6 @@ #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" -namespace ash { namespace touch_hud { // TouchHudUI handles events on the widget of the touch-hud app. After @@ -33,7 +31,7 @@ class TouchHudUI : public views::WidgetDelegateView, public views::PointerWatcher { public: explicit TouchHudUI(views::Widget* widget) - : touch_hud_renderer_(new TouchHudRenderer(widget)) { + : touch_hud_renderer_(new ash::TouchHudRenderer(widget)) { views::MusClient::Get()->pointer_watcher_event_router()->AddPointerWatcher( this, true /* want_moves */); } @@ -58,14 +56,15 @@ class TouchHudUI : public views::WidgetDelegateView, touch_hud_renderer_->HandleTouchEvent(event); } - TouchHudRenderer* touch_hud_renderer_; + // TODO(jamescook): Don't leak this. + ash::TouchHudRenderer* touch_hud_renderer_; DISALLOW_COPY_AND_ASSIGN(TouchHudUI); }; TouchHudApplication::TouchHudApplication() : binding_(this) { - registry_.AddInterface( - base::Bind(&TouchHudApplication::Create, base::Unretained(this))); + registry_.AddInterface(base::BindRepeating( + &TouchHudApplication::Create, base::Unretained(this))); } TouchHudApplication::~TouchHudApplication() = default; @@ -103,15 +102,13 @@ void TouchHudApplication::Launch(uint32_t what, mash::mojom::LaunchMode how) { widget_->Show(); } else { widget_->Close(); - base::RunLoop::QuitCurrentWhenIdleDeprecated(); + context()->QuitNow(); } } -void TouchHudApplication::Create( - mash::mojom::LaunchableRequest request) { +void TouchHudApplication::Create(mash::mojom::LaunchableRequest request) { binding_.Close(); binding_.Bind(std::move(request)); } } // namespace touch_hud -} // namespace ash diff --git a/ash/touch_hud/mus/touch_hud_application.h b/ash/components/touch_hud/touch_hud_application.h similarity index 87% rename from ash/touch_hud/mus/touch_hud_application.h rename to ash/components/touch_hud/touch_hud_application.h index 0e957478ad84a0..d199f69a204076 100644 --- a/ash/touch_hud/mus/touch_hud_application.h +++ b/ash/components/touch_hud/touch_hud_application.h @@ -2,10 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_TOUCH_HUD_MUS_TOUCH_HUD_APPLICATION_H_ -#define ASH_TOUCH_HUD_MUS_TOUCH_HUD_APPLICATION_H_ - -#include +#ifndef ASH_COMPONENTS_TOUCH_HUD_TOUCH_HUD_APPLICATION_H_ +#define ASH_COMPONENTS_TOUCH_HUD_TOUCH_HUD_APPLICATION_H_ #include "base/macros.h" #include "mash/public/mojom/launchable.mojom.h" @@ -16,9 +14,8 @@ namespace views { class AuraInit; class Widget; -} +} // namespace views -namespace ash { namespace touch_hud { class TouchHudApplication : public service_manager::Service, @@ -53,6 +50,5 @@ class TouchHudApplication : public service_manager::Service, }; } // namespace touch_hud -} // namespace ash -#endif // ASH_TOUCH_HUD_MUS_TOUCH_HUD_APPLICATION_H_ +#endif // ASH_COMPONENTS_TOUCH_HUD_TOUCH_HUD_APPLICATION_H_ diff --git a/ash/manifest.json b/ash/manifest.json index 1848fff3d241de..937969947f7ff3 100644 --- a/ash/manifest.json +++ b/ash/manifest.json @@ -57,7 +57,7 @@ "catalog": [ "directory" ], "local_state": [ "pref_client" ], "ui": [ "display_dev", "window_manager", "video_detector" ], - "touch_hud": [ "mash:launchable" ], + "touch_hud_app": [ "mash:launchable" ], "data_decoder": [ "image_decoder" ] } } diff --git a/ash/shell.cc b/ash/shell.cc index 37c4ce9e9a9e47..47aecd7e8b06af 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -1149,7 +1149,7 @@ void Shell::Init(ui::ContextFactory* context_factory, if (config == Config::MASH && shell_delegate_->GetShellConnector() && base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kShowTaps)) { mash::mojom::LaunchablePtr launchable; - shell_delegate_->GetShellConnector()->BindInterface("touch_hud", + shell_delegate_->GetShellConnector()->BindInterface("touch_hud_app", &launchable); launchable->Launch(mash::mojom::kWindow, mash::mojom::LaunchMode::DEFAULT); } diff --git a/ash/standalone/manifest.json b/ash/standalone/manifest.json index a50e79374316fe..3b109cf6a2f835 100644 --- a/ash/standalone/manifest.json +++ b/ash/standalone/manifest.json @@ -29,7 +29,7 @@ "*": [ "accessibility", "app" ], "preferences_forwarder": [ "pref_client" ], "ui": [ "display_dev", "window_manager" ], - "touch_hud": [ "mash:launchable" ] + "touch_hud_app": [ "mash:launchable" ] } } } diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn index 55886122445067..033094b027390e 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn @@ -444,8 +444,8 @@ service_manifest("chrome_content_packaged_services_manifest_overlay") { packaged_services += [ "//ash/components/autoclick:manifest", "//ash/components/quick_launch:manifest", + "//ash/components/touch_hud:manifest", "//ash:manifest", - "//ash/touch_hud/mus:manifest", "//components/font_service:manifest", ] } diff --git a/chrome/browser/mash_service_registry.cc b/chrome/browser/mash_service_registry.cc index 1b87f28c4eff3a..61f9cc1a3ed562 100644 --- a/chrome/browser/mash_service_registry.cc +++ b/chrome/browser/mash_service_registry.cc @@ -28,7 +28,7 @@ constexpr Service kServices[] = { {ash::mojom::kServiceName, "Ash Window Manager and Shell", kAshAndUiProcessGroup}, {"autoclick_app", "Accessibility Autoclick", nullptr}, - {"touch_hud", "Ash Touch Hud", nullptr}, + {"touch_hud_app", "Touch HUD", nullptr}, {font_service::mojom::kServiceName, "Font Service", nullptr}, }; diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn index 4bf78df97f1a71..75d7577efa6179 100644 --- a/chrome/utility/BUILD.gn +++ b/chrome/utility/BUILD.gn @@ -152,7 +152,7 @@ static_library("utility") { "//ash/components/autoclick:lib", "//ash/components/quick_launch:lib", "//ash/components/quick_launch/public/mojom", - "//ash/touch_hud/mus:lib", + "//ash/components/touch_hud:lib", "//chrome/services/file_util:lib", "//components/font_service:lib", "//components/font_service/public/interfaces", diff --git a/chrome/utility/DEPS b/chrome/utility/DEPS index 4a044cf838dbf1..a6c17fb2ee1769 100644 --- a/chrome/utility/DEPS +++ b/chrome/utility/DEPS @@ -48,8 +48,8 @@ specific_include_rules = { "+ash/components/autoclick/autoclick_application.h", "+ash/components/quick_launch/public", "+ash/components/quick_launch/quick_launch.h", + "+ash/components/touch_hud/touch_hud_application.h", "+ash/public/interfaces", - "+ash/touch_hud/mus/touch_hud_application.h", "+ash/window_manager_service.h", "+components/font_service/font_service_app.h", "+components/font_service/public/interfaces", diff --git a/chrome/utility/mash_service_factory.cc b/chrome/utility/mash_service_factory.cc index b55c4aff7a49bc..eed56b22f54b5f 100644 --- a/chrome/utility/mash_service_factory.cc +++ b/chrome/utility/mash_service_factory.cc @@ -9,8 +9,8 @@ #include "ash/components/autoclick/autoclick_application.h" #include "ash/components/quick_launch/public/mojom/constants.mojom.h" #include "ash/components/quick_launch/quick_launch.h" +#include "ash/components/touch_hud/touch_hud_application.h" #include "ash/public/interfaces/constants.mojom.h" -#include "ash/touch_hud/mus/touch_hud_application.h" #include "ash/window_manager_service.h" #include "base/bind.h" #include "build/build_config.h" @@ -75,8 +75,8 @@ std::unique_ptr CreateQuickLaunch() { return std::make_unique(); } -std::unique_ptr CreateTouchHud() { - return std::make_unique(); +std::unique_ptr CreateTouchHudApp() { + return std::make_unique(); } std::unique_ptr CreateFontService() { @@ -97,7 +97,7 @@ void MashServiceFactory::RegisterOutOfProcessServices( &CreateQuickLaunch); RegisterMashService(services, ash::mojom::kServiceName, &CreateAshService); RegisterMashService(services, "autoclick_app", &CreateAutoclickApp); - RegisterMashService(services, "touch_hud", &CreateTouchHud); + RegisterMashService(services, "touch_hud_app", &CreateTouchHudApp); RegisterMashService(services, font_service::mojom::kServiceName, &CreateFontService); } diff --git a/mash/BUILD.gn b/mash/BUILD.gn index 618a30a75cc283..5db5e7e6bd4dc5 100644 --- a/mash/BUILD.gn +++ b/mash/BUILD.gn @@ -28,8 +28,8 @@ group("all") { deps += [ "//ash/components/autoclick:autoclick_app", "//ash/components/quick_launch", + "//ash/components/touch_hud:touch_hud_app", "//ash/standalone:ash_standalone", - "//ash/touch_hud/mus:touch_hud", "//mash:mash_unittests", ] }