move pdf_compositor off ServiceContext/ServiceTest

https://chromium-review.googlesource.com/c/1343506
This commit is contained in:
Jeremy Apthorp 2019-01-09 16:10:39 -08:00
parent 93fbb6c092
commit a64cf5514f
2 changed files with 19 additions and 6 deletions

View file

@ -4,7 +4,6 @@
#include "atom/utility/atom_content_utility_client.h" #include "atom/utility/atom_content_utility_client.h"
#include <string>
#include <utility> #include <utility>
#include "base/command_line.h" #include "base/command_line.h"
@ -95,11 +94,6 @@ void AtomContentUtilityClient::RegisterServices(StaticServiceMap* services) {
proxy_resolver_info); proxy_resolver_info);
#if BUILDFLAG(ENABLE_PRINTING) #if BUILDFLAG(ENABLE_PRINTING)
service_manager::EmbeddedServiceInfo pdf_compositor_info;
pdf_compositor_info.factory =
base::BindRepeating(&printing::CreatePdfCompositorService, std::string());
services->emplace(printing::mojom::kServiceName, pdf_compositor_info);
service_manager::EmbeddedServiceInfo printing_info; service_manager::EmbeddedServiceInfo printing_info;
printing_info.factory = printing_info.factory =
base::BindRepeating(&printing::PrintingService::CreateService); base::BindRepeating(&printing::PrintingService::CreateService);
@ -107,4 +101,18 @@ void AtomContentUtilityClient::RegisterServices(StaticServiceMap* services) {
#endif #endif
} }
std::unique_ptr<service_manager::Service>
AtomContentUtilityClient::HandleServiceRequest(
const std::string& service_name,
service_manager::mojom::ServiceRequest request) {
#if BUILDFLAG(ENABLE_PRINTING)
if (service_name == printing::mojom::kServiceName) {
return printing::CreatePdfCompositorService(std::string(),
std::move(request));
}
#endif
return nullptr;
}
} // namespace atom } // namespace atom

View file

@ -6,6 +6,7 @@
#define ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_ #define ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_
#include <memory> #include <memory>
#include <string>
#include <vector> #include <vector>
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
@ -27,6 +28,10 @@ class AtomContentUtilityClient : public content::ContentUtilityClient {
bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message) override;
void RegisterServices(StaticServiceMap* services) override; void RegisterServices(StaticServiceMap* services) override;
std::unique_ptr<service_manager::Service> HandleServiceRequest(
const std::string& service_name,
service_manager::mojom::ServiceRequest request) override;
private: private:
#if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN) #if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)
std::unique_ptr<printing::PrintingHandler> printing_handler_; std::unique_ptr<printing::PrintingHandler> printing_handler_;