Skip to content
This repository was archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
Fix printing service on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh committed Mar 23, 2018
1 parent 379ed89 commit ad0a76c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
25 changes: 25 additions & 0 deletions atom/utility/atom_content_utility_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,20 @@
#include "extensions/utility/utility_handler.h"
#endif

#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#include "chrome/services/printing/printing_service.h"
#include "chrome/services/printing/public/interfaces/constants.mojom.h"
#endif

#if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \
(BUILDFLAG(ENABLE_BASIC_PRINTING) && defined(OS_WIN))
#include "chrome/utility/printing_handler.h"
#endif

#if defined(OS_WIN)
#include "chrome/services/printing/pdf_to_emf_converter_factory.h"
#endif

namespace atom {

namespace {
Expand Down Expand Up @@ -106,6 +115,13 @@ void AtomContentUtilityClient::UtilityThreadStarted() {
if (!utility_process_running_elevated_) {
registry->AddInterface(base::Bind(CreateResourceUsageReporter),
base::ThreadTaskRunnerHandle::Get());
#if defined(OS_WIN)
// TODO(crbug.com/798782): remove when the Cloud print chrome/service is
// removed.
registry->AddInterface(
base::Bind(printing::PdfToEmfConverterFactory::Create),
base::ThreadTaskRunnerHandle::Get());
#endif
}

connection->AddConnectionFilter(
Expand Down Expand Up @@ -140,6 +156,15 @@ void AtomContentUtilityClient::RegisterServices(
base::Bind(&BraveProfileImportService::CreateService);
services->emplace(chrome::mojom::kProfileImportServiceName,
profile_import_info);
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
{
service_manager::EmbeddedServiceInfo printing_info;
printing_info.factory =
base::Bind(&printing::PrintingService::CreateService);
services->emplace(printing::mojom::kChromePrintingServiceName,
printing_info);
}
#endif
}

// static
Expand Down
9 changes: 9 additions & 0 deletions brave/browser/brave_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
#include "components/spellcheck/browser/spellcheck_message_filter_platform.h"
#endif

#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#include "chrome/services/printing/public/interfaces/constants.mojom.h"
#endif

#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/debug/leak_annotations.h"
#include "components/crash/content/app/breakpad_linux.h"
Expand Down Expand Up @@ -333,6 +337,11 @@ void BraveContentBrowserClient::RegisterOutOfProcessServices(

(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);

#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
(*services)[printing::mojom::kChromePrintingServiceName] =
l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME);
#endif
}

void BraveContentBrowserClient::BindInterfaceRequest(
Expand Down

0 comments on commit ad0a76c

Please sign in to comment.