Skip to content

Commit

Permalink
Rename a bunch of Mojo Application stuff to reference Services.
Browse files Browse the repository at this point in the history
. MojoShellConnection -> ServiceManagerConnection
. MojoChildConnection -> ChildConnection
. EmbeddedApplicationRunner -> EmbeddedServiceRunner
. *MojoApplication* -> *Service*

R=rockot@chromium.org
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2398783002
Cr-Commit-Position: refs/heads/master@{#423757}
  • Loading branch information
ben authored and Commit bot committed Oct 7, 2016
1 parent dcf75c5 commit d32292b
Show file tree
Hide file tree
Showing 91 changed files with 693 additions and 683 deletions.
2 changes: 1 addition & 1 deletion ash/common/wm_shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class ASH_EXPORT WmShell {
return window_selector_controller_.get();
}

// Returns true when ash is running in its own mojo application/service.
// Returns true when ash is running as a shell::Service.
virtual bool IsRunningInMash() const = 0;

virtual WmWindow* NewWindow(ui::wm::WindowType window_type,
Expand Down
2 changes: 1 addition & 1 deletion blimp/engine/app/blimp_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ BlimpContentBrowserClient::GetServiceManifestOverlay(
const std::string& name) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
int id = -1;
if (name == content::kBrowserMojoApplicationName) {
if (name == content::kBrowserServiceName) {
id = IDR_BLIMP_CONTENT_BROWSER_MANIFEST_OVERLAY;
}
if (id == -1) {
Expand Down
15 changes: 8 additions & 7 deletions chrome/browser/chrome_browser_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@

#if defined(USE_AURA)
#include "chrome/browser/lifetime/application_lifetime.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "services/shell/runner/common/client_util.h"
#endif

Expand Down Expand Up @@ -1365,17 +1365,18 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
return content::RESULT_CODE_NORMAL_EXIT;
}

void ChromeBrowserMainParts::MojoShellConnectionStarted(
content::MojoShellConnection* connection) {
void ChromeBrowserMainParts::ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection) {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->MojoShellConnectionStarted(connection);
chrome_extra_parts_[i]->ServiceManagerConnectionStarted(connection);
}

void ChromeBrowserMainParts::PreMainMessageLoopRun() {
#if defined(USE_AURA)
if (content::MojoShellConnection::GetForProcess() && shell::ShellIsRemote()) {
content::MojoShellConnection::GetForProcess()->SetConnectionLostClosure(
base::Bind(&chrome::SessionEnding));
if (content::ServiceManagerConnection::GetForProcess() &&
shell::ShellIsRemote()) {
content::ServiceManagerConnection::GetForProcess()->
SetConnectionLostClosure(base::Bind(&chrome::SessionEnding));
}
#endif
TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreMainMessageLoopRun");
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/chrome_browser_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
void PreMainMessageLoopStart() override;
void PostMainMessageLoopStart() override;
int PreCreateThreads() override;
void MojoShellConnectionStarted(
content::MojoShellConnection* connection) override;
void ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection) override;
void PreMainMessageLoopRun() override;
bool MainMessageLoopRun(int* result_code) override;
void PostMainMessageLoopRun() override;
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/chrome_browser_main_extra_parts.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define CHROME_BROWSER_CHROME_BROWSER_MAIN_EXTRA_PARTS_H_

namespace content {
class MojoShellConnection;
class ServiceManagerConnection;
}

// Interface class for Parts owned by ChromeBrowserMainParts.
Expand Down Expand Up @@ -38,8 +38,8 @@ class ChromeBrowserMainExtraParts {

// MainMessageLoopRun methods.
virtual void PreCreateThreads() {}
virtual void MojoShellConnectionStarted(
content::MojoShellConnection* connection) {}
virtual void ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection) {}
virtual void PreProfileInit() {}
virtual void PostProfileInit() {}
virtual void PreBrowserStart() {}
Expand Down
28 changes: 14 additions & 14 deletions chrome/browser/chrome_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
#include "content/public/common/content_descriptors.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/sandbox_type.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/common/service_names.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/web_preferences.h"
Expand Down Expand Up @@ -3041,24 +3041,24 @@ void ChromeContentBrowserClient::ExposeInterfacesToGpuProcess(
metrics::CallStackProfileParams::GPU_PROCESS));
}

void ChromeContentBrowserClient::RegisterInProcessMojoApplications(
StaticMojoApplicationMap* apps) {
void ChromeContentBrowserClient::RegisterInProcessServices(
StaticServiceMap* services) {
#if (ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)
content::MojoApplicationInfo app_info;
app_info.application_factory = base::Bind(&media::CreateMojoMediaApplication);
apps->insert(std::make_pair("service:media", app_info));
content::ServiceInfo info;
info.factory = base::Bind(&media::CreateMojoMediaApplication);
services->insert(std::make_pair("service:media", app_info));
#endif
#if defined(OS_CHROMEOS)
content::MojoShellConnection::GetForProcess()->AddConnectionFilter(
content::ServiceManagerConnection::GetForProcess()->AddConnectionFilter(
base::MakeUnique<chromeos::ChromeInterfaceFactory>());
#endif // OS_CHROMEOS
}

void ChromeContentBrowserClient::RegisterOutOfProcessMojoApplications(
OutOfProcessMojoApplicationMap* apps) {
void ChromeContentBrowserClient::RegisterOutOfProcessServices(
OutOfProcessServiceMap* services) {
#if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS)
apps->insert(std::make_pair("service:media",
base::ASCIIToUTF16("Media App")));
services->insert(std::make_pair("service:media",
base::ASCIIToUTF16("Media Service")));
#endif
}

Expand All @@ -3067,11 +3067,11 @@ ChromeContentBrowserClient::GetServiceManifestOverlay(
const std::string& name) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
int id = -1;
if (name == content::kBrowserMojoApplicationName)
if (name == content::kBrowserServiceName)
id = IDR_CHROME_CONTENT_BROWSER_MANIFEST_OVERLAY;
else if (name == content::kGpuMojoApplicationName)
else if (name == content::kGpuServiceName)
id = IDR_CHROME_CONTENT_GPU_MANIFEST_OVERLAY;
else if (name == content::kUtilityMojoApplicationName)
else if (name == content::kUtilityServiceName)
id = IDR_CHROME_CONTENT_UTILITY_MANIFEST_OVERLAY;
if (id == -1)
return nullptr;
Expand Down
7 changes: 3 additions & 4 deletions chrome/browser/chrome_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,9 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
void ExposeInterfacesToGpuProcess(
shell::InterfaceRegistry* registry,
content::GpuProcessHost* render_process_host) override;
void RegisterInProcessMojoApplications(
StaticMojoApplicationMap* apps) override;
void RegisterOutOfProcessMojoApplications(
OutOfProcessMojoApplicationMap* apps) override;
void RegisterInProcessServices(StaticServiceMap* services) override;
void RegisterOutOfProcessServices(
OutOfProcessServiceMap* services) override;
std::unique_ptr<base::Value> GetServiceManifestOverlay(
const std::string& name) override;
void OpenURL(content::BrowserContext* browser_context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
Expand Down Expand Up @@ -601,7 +601,7 @@ void AccessibilityManager::UpdateAutoclickFromPref() {

if (chrome::IsRunningInMash()) {
shell::Connector* connector =
content::MojoShellConnection::GetForProcess()->GetConnector();
content::ServiceManagerConnection::GetForProcess()->GetConnector();
mash::mojom::LaunchablePtr launchable;
connector->ConnectToInterface("service:accessibility_autoclick",
&launchable);
Expand Down Expand Up @@ -639,7 +639,7 @@ void AccessibilityManager::UpdateAutoclickDelayFromPref() {

if (chrome::IsRunningInMash()) {
shell::Connector* connector =
content::MojoShellConnection::GetForProcess()->GetConnector();
content::ServiceManagerConnection::GetForProcess()->GetConnector();
ash::autoclick::mojom::AutoclickControllerPtr autoclick_controller;
connector->ConnectToInterface("service:accessibility_autoclick",
&autoclick_controller);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/chromeos/chrome_interface_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "chrome/browser/ui/ash/system_tray_client.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "mash/public/interfaces/launchable.mojom.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "services/shell/public/cpp/connection.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "services/shell/public/cpp/connector.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/codec/jpeg_codec.h"
Expand Down Expand Up @@ -211,7 +211,7 @@ void SetWallpaper(const gfx::ImageSkia& image,
wallpaper::WallpaperLayout layout) {
if (chrome::IsRunningInMash()) {
shell::Connector* connector =
content::MojoShellConnection::GetForProcess()->GetConnector();
content::ServiceManagerConnection::GetForProcess()->GetConnector();
ash::mojom::WallpaperControllerPtr wallpaper_controller;
connector->ConnectToInterface("service:ash", &wallpaper_controller);
wallpaper_controller->SetWallpaper(*image.bitmap(),
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/ash/chrome_shell_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#include "components/user_manager/user_manager.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "ui/app_list/presenter/app_list_presenter.h"
#include "ui/aura/window.h"
#include "ui/base/ime/chromeos/input_method_manager.h"
Expand Down Expand Up @@ -333,7 +333,7 @@ ChromeShellDelegate::~ChromeShellDelegate() {
}

shell::Connector* ChromeShellDelegate::GetShellConnector() const {
return content::MojoShellConnection::GetForProcess()->GetConnector();
return content::ServiceManagerConnection::GetForProcess()->GetConnector();
}

bool ChromeShellDelegate::IsFirstRunAfterBoot() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
#include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
#include "chrome/grit/theme_resources.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "extensions/common/constants.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "mojo/common/common_type_converters.h"
Expand Down Expand Up @@ -70,7 +70,7 @@ void ChromeMashShelfController::LaunchItem(const std::string& app_id) {

void ChromeMashShelfController::Init() {
shell::Connector* connector =
content::MojoShellConnection::GetForProcess()->GetConnector();
content::ServiceManagerConnection::GetForProcess()->GetConnector();
connector->ConnectToInterface("service:ash", &shelf_controller_);

// Initialize shelf alignment and auto-hide behavior from preferences.
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/ash/system_tray_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "chrome/grit/generated_resources.h"
#include "chromeos/login/login_state.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "net/base/escape.h"
#include "services/shell/public/cpp/connector.h"
#include "ui/base/l10n/l10n_util.h"
Expand Down Expand Up @@ -183,7 +183,7 @@ void SystemTrayClient::ConnectToSystemTray() {
return;

shell::Connector* connector =
content::MojoShellConnection::GetForProcess()->GetConnector();
content::ServiceManagerConnection::GetForProcess()->GetConnector();
// Under mash the SystemTray interface is in the ash process. In classic ash
// we provide it to ourself.
if (chrome::IsRunningInMash())
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/browser_command_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/extension_system.h"
#include "mash/public/interfaces/launchable.mojom.h"
Expand Down Expand Up @@ -631,7 +631,7 @@ void BrowserCommandController::ExecuteCommandWithDisposition(
case IDC_TOUCH_HUD_PROJECTION_TOGGLE:
if (chrome::IsRunningInMash()) {
shell::Connector* connector =
content::MojoShellConnection::GetForProcess()->GetConnector();
content::ServiceManagerConnection::GetForProcess()->GetConnector();
mash::mojom::LaunchablePtr launchable;
connector->ConnectToInterface("service:touch_hud", &launchable);
launchable->Launch(mash::mojom::kWindow,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#if defined(USE_AURA)
#include "base/run_loop.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "services/shell/public/cpp/connector.h"
#include "services/shell/runner/common/client_util.h"
#include "services/ui/public/cpp/gpu_service.h"
Expand Down Expand Up @@ -51,8 +51,8 @@ void ChromeBrowserMainExtraPartsViews::PreCreateThreads() {
#endif
}

void ChromeBrowserMainExtraPartsViews::MojoShellConnectionStarted(
content::MojoShellConnection* connection) {
void ChromeBrowserMainExtraPartsViews::ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection) {
DCHECK(connection);
#if defined(USE_AURA)
if (shell::ShellIsRemote()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ChromeBrowserMainExtraPartsViews : public ChromeBrowserMainExtraParts {
// Overridden from ChromeBrowserMainExtraParts:
void ToolkitInitialized() override;
void PreCreateThreads() override;
void MojoShellConnectionStarted(
content::MojoShellConnection* connection) override;
void ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection) override;

private:
std::unique_ptr<views::ViewsDelegate> views_delegate_;
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/ui/views/tabs/tab_drag_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

#if defined(USE_AURA)
#include "chrome/browser/ui/views/tabs/window_finder_mus.h" // nogncheck
#include "content/public/common/mojo_shell_connection.h" // nogncheck
#include "content/public/common/service_manager_connection.h" // nogncheck
#include "services/shell/runner/common/client_util.h" // nogncheck
#include "ui/aura/env.h" // nogncheck
#include "ui/aura/window.h" // nogncheck
Expand Down Expand Up @@ -229,9 +229,9 @@ TabDragController::TabDragController()
instance_ = this;

#if defined(USE_AURA)
content::MojoShellConnection* mojo_shell_connection =
content::MojoShellConnection::GetForProcess();
if (mojo_shell_connection && shell::ShellIsRemote())
content::ServiceManagerConnection* service_manager_connection =
content::ServiceManagerConnection::GetForProcess();
if (service_manager_connection && shell::ShellIsRemote())
window_finder_.reset(new WindowFinderMus);
else
#endif
Expand Down
20 changes: 11 additions & 9 deletions chrome/test/base/mash_browser_tests_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "chrome/test/base/chrome_test_launcher.h"
#include "chrome/test/base/chrome_test_suite.h"
#include "chrome/test/base/mojo_test_connector.h"
#include "content/public/common/mojo_shell_connection.h"
#include "content/public/common/service_manager_connection.h"
#include "content/public/test/test_launcher.h"
#include "mash/package/mash_packaged_service.h"
#include "services/shell/public/cpp/connector.h"
Expand Down Expand Up @@ -113,10 +113,10 @@ class MashTestLauncherDelegate : public ChromeTestLauncherDelegate {
DISALLOW_COPY_AND_ASSIGN(MashTestLauncherDelegate);
};

std::unique_ptr<content::MojoShellConnection> CreateMojoShellConnection(
MashTestLauncherDelegate* delegate) {
std::unique_ptr<content::MojoShellConnection> connection(
content::MojoShellConnection::Create(
std::unique_ptr<content::ServiceManagerConnection>
CreateServiceManagerConnection(MashTestLauncherDelegate* delegate) {
std::unique_ptr<content::ServiceManagerConnection> connection(
content::ServiceManagerConnection::Create(
delegate->GetMojoTestConnectorForSingleProcess()->Init(),
base::ThreadTaskRunnerHandle::Get()));
connection->Start();
Expand Down Expand Up @@ -170,14 +170,16 @@ bool RunMashBrowserTests(int argc, char** argv, int* exit_code) {
int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2);
MashTestLauncherDelegate delegate;
// --single_process and no primoridal pipe token indicate we were run directly
// from the command line. In this case we have to start up MojoShellConnection
// from the command line. In this case we have to start up
// ServiceManagerConnection
// as though we were embedded.
content::MojoShellConnection::Factory shell_connection_factory;
content::ServiceManagerConnection::Factory shell_connection_factory;
if (command_line.HasSwitch(content::kSingleProcessTestsFlag) &&
!command_line.HasSwitch(switches::kPrimordialPipeToken)) {
shell_connection_factory =
base::Bind(&CreateMojoShellConnection, &delegate);
content::MojoShellConnection::SetFactoryForTest(&shell_connection_factory);
base::Bind(&CreateServiceManagerConnection, &delegate);
content::ServiceManagerConnection::SetFactoryForTest(
&shell_connection_factory);
}
*exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv);
return true;
Expand Down
Loading

0 comments on commit d32292b

Please sign in to comment.