Commit d89f32bf authored by James Cook's avatar James Cook Committed by Commit Bot

Move quick_launch mojo app to //ash/components

It's a mojo mini-app.  It's only used with mash, which only runs on
Chrome OS. Move it to the Chrome OS UI directory.

NOPRESUBMIT=true

Bug: none
Test: bots
Change-Id: I8da161c8ec4c95ab284d4b0e5248b6fff5a04406
Reviewed-on: https://chromium-review.googlesource.com/917208
Commit-Queue: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536758}
parent bac67e8b
......@@ -2027,11 +2027,11 @@ source_set("mash_unittests") {
":ash_service_resources",
"//ash",
"//ash:test_support_without_content",
"//ash/components/quick_launch/public/mojom:constants",
"//ash/public/cpp",
"//base",
"//base/test:test_config",
"//base/test:test_support",
"//mash/quick_launch/public/mojom:constants",
"//mojo/public/cpp/system",
"//services/service_manager/public/cpp:service_test_support",
"//services/ui/common:mus_common",
......@@ -2058,7 +2058,7 @@ source_set("mash_unittests") {
data_deps = [
":ash_service",
"//mash/quick_launch",
"//ash/components/quick_launch",
"//services/ui/ime/test_ime_driver",
]
}
......@@ -94,7 +94,7 @@ include_rules = [
specific_include_rules = {
"app_launch_unittest.cc": [
"+mash/quick_launch/public",
"+ash/components/quick_launch/public",
],
"root_window_controller\.*": [
"+ash/host"
......
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/components/quick_launch/public/mojom/constants.mojom.h"
#include "ash/public/interfaces/constants.mojom.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/run_loop.h"
#include "mash/quick_launch/public/mojom/constants.mojom.h"
#include "services/service_manager/public/cpp/service_test.h"
#include "services/ui/public/interfaces/constants.mojom.h"
#include "services/ui/public/interfaces/window_server_test.mojom.h"
......@@ -37,7 +37,7 @@ class AppLaunchTest : public service_manager::test::ServiceTest {
TEST_F(AppLaunchTest, TestQuickLaunch) {
connector()->StartService(mojom::kServiceName);
connector()->StartService(mash::quick_launch::mojom::kServiceName);
connector()->StartService(quick_launch::mojom::kServiceName);
ui::mojom::WindowServerTestPtr test_interface;
connector()->BindInterface(ui::mojom::kServiceName, &test_interface);
......@@ -45,7 +45,7 @@ TEST_F(AppLaunchTest, TestQuickLaunch) {
base::RunLoop run_loop;
bool success = false;
test_interface->EnsureClientHasDrawnWindow(
mash::quick_launch::mojom::kServiceName,
quick_launch::mojom::kServiceName,
base::Bind(&RunCallback, &success, run_loop.QuitClosure()));
run_loop.Run();
EXPECT_TRUE(success);
......
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mash/quick_launch/quick_launch.h"
#include "services/service_manager/public/c/main.h"
#include "ash/components/quick_launch/quick_launch.h"
#include "services/service_manager/public/cpp/service_runner.h"
MojoResult ServiceMain(MojoHandle service_request_handle) {
mash::quick_launch::QuickLaunch* app = new mash::quick_launch::QuickLaunch;
quick_launch::QuickLaunch* app = new quick_launch::QuickLaunch;
app->set_running_standalone(true);
service_manager::ServiceRunner runner(app);
return runner.Run(service_request_handle);
......
......@@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module mash.quick_launch.mojom;
module quick_launch.mojom;
const string kServiceName = "quick_launch";
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mash/quick_launch/quick_launch.h"
#include "ash/components/quick_launch/quick_launch.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
......@@ -28,7 +28,6 @@
#include "ui/views/widget/widget_delegate.h"
#include "url/gurl.h"
namespace mash {
namespace quick_launch {
class QuickLaunchUI : public views::WidgetDelegateView,
......@@ -47,9 +46,7 @@ class QuickLaunchUI : public views::WidgetDelegateView,
UpdateEntries();
}
~QuickLaunchUI() override {
quick_launch_->RemoveWindow(GetWidget());
}
~QuickLaunchUI() override { quick_launch_->RemoveWindow(GetWidget()); }
private:
// Overridden from views::WidgetDelegate:
......@@ -124,7 +121,7 @@ class QuickLaunchUI : public views::WidgetDelegateView,
void UpdateEntries() {
catalog_->GetEntriesProvidingCapability(
"mash:launchable",
base::Bind(&QuickLaunchUI::OnGotCatalogEntries,
base::BindRepeating(&QuickLaunchUI::OnGotCatalogEntries,
base::Unretained(this)));
}
......@@ -136,9 +133,9 @@ class QuickLaunchUI : public views::WidgetDelegateView,
void Launch(const std::string& name, bool new_window) {
::mash::mojom::LaunchablePtr launchable;
connector_->BindInterface(name, &launchable);
launchable->Launch(mojom::kWindow,
new_window ? mojom::LaunchMode::MAKE_NEW
: mojom::LaunchMode::REUSE);
launchable->Launch(mash::mojom::kWindow,
new_window ? mash::mojom::LaunchMode::MAKE_NEW
: mash::mojom::LaunchMode::REUSE);
}
QuickLaunch* quick_launch_;
......@@ -153,7 +150,7 @@ class QuickLaunchUI : public views::WidgetDelegateView,
QuickLaunch::QuickLaunch() {
registry_.AddInterface<::mash::mojom::Launchable>(
base::Bind(&QuickLaunch::Create, base::Unretained(this)));
base::BindRepeating(&QuickLaunch::Create, base::Unretained(this)));
}
QuickLaunch::~QuickLaunch() {
......@@ -183,7 +180,7 @@ void QuickLaunch::OnStart() {
return;
}
Launch(mojom::kWindow, mojom::LaunchMode::MAKE_NEW);
Launch(mash::mojom::kWindow, mash::mojom::LaunchMode::MAKE_NEW);
}
void QuickLaunch::OnBindInterface(
......@@ -193,9 +190,9 @@ void QuickLaunch::OnBindInterface(
registry_.BindInterface(interface_name, std::move(interface_pipe));
}
void QuickLaunch::Launch(uint32_t what, mojom::LaunchMode how) {
bool reuse = how == mojom::LaunchMode::REUSE ||
how == mojom::LaunchMode::DEFAULT;
void QuickLaunch::Launch(uint32_t what, mash::mojom::LaunchMode how) {
bool reuse = how == mash::mojom::LaunchMode::REUSE ||
how == mash::mojom::LaunchMode::DEFAULT;
if (reuse && !windows_.empty()) {
windows_.back()->Activate();
return;
......@@ -216,4 +213,3 @@ void QuickLaunch::Create(::mash::mojom::LaunchableRequest request) {
}
} // namespace quick_launch
} // namespace mash
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MASH_QUICK_LAUNCH_QUICK_LAUNCH_H_
#define MASH_QUICK_LAUNCH_QUICK_LAUNCH_H_
#ifndef ASH_COMPONENTS_QUICK_LAUNCH_QUICK_LAUNCH_H_
#define ASH_COMPONENTS_QUICK_LAUNCH_QUICK_LAUNCH_H_
#include <memory>
......@@ -16,9 +16,8 @@
namespace views {
class AuraInit;
class Widget;
}
} // namespace views
namespace mash {
namespace quick_launch {
class QuickLaunch : public service_manager::Service,
......@@ -56,6 +55,5 @@ class QuickLaunch : public service_manager::Service,
};
} // namespace quick_launch
} // namespace mash
#endif // MASH_QUICK_LAUNCH_QUICK_LAUNCH_H_
#endif // ASH_COMPONENTS_QUICK_LAUNCH_QUICK_LAUNCH_H_
......@@ -379,8 +379,8 @@ static_library("test_support") {
if (enable_mus) {
deps += [
"//ash/components/quick_launch/public/mojom:constants",
"//mash/common",
"//mash/quick_launch/public/mojom:constants",
"//services/ui/public/interfaces:constants",
]
}
......@@ -440,7 +440,7 @@ service_manifest("chrome_content_packaged_services_manifest_overlay") {
"//chrome/browser/chrome_content_packaged_services_manifest_overlay.json"
packaged_services = chrome_packaged_services
if (enable_mus) {
packaged_services += [ "//mash/quick_launch:manifest" ]
packaged_services += [ "//ash/components/quick_launch:manifest" ]
}
if (is_chromeos) {
packaged_services += [
......
......@@ -31,7 +31,7 @@ include_rules = [
"+extensions/common/constants.h",
"+headless/public", # For headless mode.
"+mash/common",
"+mash/quick_launch/public",
"+ash/components/quick_launch/public",
"+native_client/src/trusted/service_runtime/osx",
"+remoting/client/plugin",
"+sandbox",
......
......@@ -2869,11 +2869,11 @@ split_static_library("browser") {
]
deps += [
"//ash",
"//ash/components/quick_launch/public/mojom:constants",
"//ash/public/cpp",
"//chrome/browser/chromeos",
"//components/font_service:lib",
"//components/font_service/public/interfaces",
"//mash/quick_launch/public/mojom:constants",
"//services/ui/public/cpp/input_devices",
"//services/ui/public/cpp/input_devices:input_device_controller",
"//services/ui/public/interfaces",
......
......@@ -85,6 +85,7 @@ include_rules = [
# //ash/README.md.
"-ash",
"+ash/public",
"+ash/components/quick_launch/public/mojom",
# chrome only needs switches from cc. All usage of the compositor is from
# content. Definitely don't include generic stuff from cc/base here, if this
......@@ -112,8 +113,6 @@ include_rules = [
# Should be removed once the actual network service ships.
"+content/public/network",
"+mash/quick_launch/public/mojom",
# Other libraries.
"+libxml",
"+third_party/google_toolbox_for_mac/src",
......@@ -204,7 +203,7 @@ specific_include_rules = {
"+ash/shell.h",
],
"mash_service_registry.cc": [
"+mash/quick_launch/quick_launch.h",
"+ash/components/quick_launch/quick_launch.h",
],
"display_info_provider_chromeos_unittest.cc": [
"+ui/events/devices/touch_device_transform.h"
......
......@@ -4,12 +4,11 @@
#include "chrome/browser/mash_service_registry.h"
#include "ash/components/quick_launch/public/mojom/constants.mojom.h"
#include "ash/public/interfaces/constants.mojom.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "components/font_service/public/interfaces/constants.mojom.h"
#include "mash/quick_launch/public/mojom/constants.mojom.h"
#include "mash/quick_launch/quick_launch.h"
#include "services/ui/public/interfaces/constants.mojom.h"
using content::ContentBrowserClient;
......@@ -24,7 +23,7 @@ struct Service {
};
constexpr Service kServices[] = {
{mash::quick_launch::mojom::kServiceName, "Quick Launch", nullptr},
{quick_launch::mojom::kServiceName, "Quick Launch", nullptr},
{ui::mojom::kServiceName, "UI Service", kAshAndUiProcessGroup},
{ash::mojom::kServiceName, "Ash Window Manager and Shell",
kAshAndUiProcessGroup},
......
include_rules = [
# TODO(mash): Remove. http://crbug.com/678705
"+ash",
"+ash/components/quick_launch/public",
"+chrome/browser/ui/views",
"+components/constrained_window",
"+mash/common",
"+mash/quick_launch/public",
"+services/ui/public/cpp",
"+components/user_manager",
"+third_party/libaddressinput",
......
......@@ -149,12 +149,12 @@ static_library("utility") {
deps += [
"//ash",
"//ash/autoclick/mus:lib",
"//ash/components/quick_launch:lib",
"//ash/components/quick_launch/public/mojom",
"//ash/touch_hud/mus:lib",
"//chrome/services/file_util:lib",
"//components/font_service:lib",
"//components/font_service/public/interfaces",
"//mash/quick_launch:lib",
"//mash/quick_launch/public/mojom",
"//services/ui:lib",
"//services/ui/public/interfaces",
]
......
......@@ -44,14 +44,14 @@ include_rules = [
specific_include_rules = {
"mash_service_factory.cc": [
"+ash/window_manager_service.h",
"+ash/autoclick/mus/autoclick_application.h",
"+ash/components/quick_launch/public",
"+ash/components/quick_launch/quick_launch.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",
"+mash/quick_launch/public",
"+mash/quick_launch/quick_launch.h",
"+services/ui/common/image_cursors_set.h",
"+services/ui/public",
"+services/ui/service.h",
......
......@@ -7,6 +7,8 @@
#include <memory>
#include "ash/autoclick/mus/autoclick_application.h"
#include "ash/components/quick_launch/public/mojom/constants.mojom.h"
#include "ash/components/quick_launch/quick_launch.h"
#include "ash/public/interfaces/constants.mojom.h"
#include "ash/touch_hud/mus/touch_hud_application.h"
#include "ash/window_manager_service.h"
......@@ -14,8 +16,6 @@
#include "build/build_config.h"
#include "components/font_service/font_service_app.h"
#include "components/font_service/public/interfaces/constants.mojom.h"
#include "mash/quick_launch/public/mojom/constants.mojom.h"
#include "mash/quick_launch/quick_launch.h"
#include "services/ui/common/image_cursors_set.h"
#include "services/ui/public/interfaces/constants.mojom.h"
#include "services/ui/service.h"
......@@ -72,7 +72,7 @@ std::unique_ptr<service_manager::Service> CreateAccessibilityAutoclick() {
}
std::unique_ptr<service_manager::Service> CreateQuickLaunch() {
return std::make_unique<mash::quick_launch::QuickLaunch>();
return std::make_unique<quick_launch::QuickLaunch>();
}
std::unique_ptr<service_manager::Service> CreateTouchHud() {
......@@ -93,7 +93,7 @@ MashServiceFactory::~MashServiceFactory() = default;
void MashServiceFactory::RegisterOutOfProcessServices(
content::ContentUtilityClient::StaticServiceMap* services) {
RegisterUiService(services, cursors_.get());
RegisterMashService(services, mash::quick_launch::mojom::kServiceName,
RegisterMashService(services, quick_launch::mojom::kServiceName,
&CreateQuickLaunch);
RegisterMashService(services, ash::mojom::kServiceName, &CreateAshService);
RegisterMashService(services, "accessibility_autoclick",
......
......@@ -17,7 +17,6 @@ group("all") {
"//components/leveldb",
"//mash/catalog_viewer",
"//mash/example",
"//mash/quick_launch",
"//mash/runner",
"//mash/session",
"//mash/simple_wm",
......@@ -28,6 +27,7 @@ group("all") {
if (is_chromeos) {
deps += [
"//ash/autoclick/mus:accessibility_autoclick",
"//ash/components/quick_launch",
"//ash/standalone:ash_standalone",
"//ash/touch_hud/mus:touch_hud",
"//mash:mash_unittests",
......@@ -43,7 +43,6 @@ catalog("catalog") {
standalone_services = [
"//components/leveldb:manifest",
"//mash/catalog_viewer:manifest",
"//mash/quick_launch:manifest",
"//mash/session:manifest",
"//mash/task_viewer:manifest",
"//services/ui:manifest",
......@@ -59,6 +58,7 @@ catalog("catalog") {
if (is_chromeos) {
standalone_services += [
"//ash:manifest",
"//ash/components/quick_launch:manifest",
"//ash/standalone:manifest",
]
}
......
......@@ -17,18 +17,18 @@ source_set("lib") {
deps = [
"//base",
"//mash/common",
"//mash/quick_launch/public/mojom:constants",
"//mojo/common",
"//mojo/public/cpp/bindings",
"//services/service_manager/public/cpp",
]
if (is_chromeos) {
deps += [ "//ash/components/quick_launch/public/mojom:constants" ]
data_deps = [
"//mash/quick_launch",
"//ash:ash_service",
"//ash/components/quick_launch",
]
if (is_chromeos) {
data_deps += [ "//ash:ash_service" ]
}
}
......
include_rules = [
"+ash/components/quick_launch/public",
"+content/public/common/service_names.mojom.h",
]
......@@ -8,10 +8,13 @@
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "mash/common/config.h"
#include "mash/quick_launch/public/mojom/constants.mojom.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/service_context.h"
#if defined(OS_CHROMEOS)
#include "ash/components/quick_launch/public/mojom/constants.mojom.h" // nogncheck
#endif
namespace mash {
namespace session {
......@@ -20,13 +23,15 @@ Session::~Session() = default;
void Session::OnStart() {
StartWindowManager();
#if defined(OS_CHROMEOS)
// TODO(jonross): Re-enable when QuickLaunch for all builds once it no longer
// deadlocks with ServiceManager shutdown in mash_browser_tests.
// (crbug.com/594852)
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
quick_launch::mojom::kServiceName)) {
StartQuickLaunch();
context()->connector()->StartService(quick_launch::mojom::kServiceName);
}
#endif // defined(OS_CHROMEOS)
}
void Session::StartWindowManager() {
......@@ -35,11 +40,5 @@ void Session::StartWindowManager() {
context()->connector()->StartService(common::GetWindowManagerServiceName());
}
void Session::StartQuickLaunch() {
// TODO(beng): monitor this service for death & bring down the whole system
// if necessary.
context()->connector()->StartService(quick_launch::mojom::kServiceName);
}
} // namespace session
} // namespace main
......@@ -21,7 +21,6 @@ class Session : public service_manager::Service {
void OnStart() override;
void StartWindowManager();
void StartQuickLaunch();
DISALLOW_COPY_AND_ASSIGN(Session);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment