Commit a2fa14ce authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Make printing service ifdefs consistent.

- "Print Compositor" is always on when printing is on.
- "Printing Service" is for either Print Preview (PWG conversion), or
  printing on Windows (EMF/PS/Text conversion).
- EMF bits are Windows-only.

Additionally:
- Fix the name of "Printing Service" to be consistent with other names.
- Remove an unused GRD entry for the "PDF Convertor" which was the
  precursor to the "Printing Service".

Change-Id: I69744f91b8113a8104438271c7c58fff8161cde7
Reviewed-on: https://chromium-review.googlesource.com/1054639
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarJay Civelli <jcivelli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558541}
parent fffd4812
......@@ -3255,9 +3255,6 @@ are declared in build/common.gypi.
</message>
</if>
<if expr="is_win">
<message name="IDS_UTILITY_PROCESS_PDF_CONVERTOR_NAME" desc="The name of the utility process used for converting PDFs to a different format.">
PDF Convertor
</message>
<message name="IDS_UTILITY_PROCESS_FILE_DIALOG_NAME" desc="The name of the utility process used for handling a file open/save dialog.">
File Open/Save Dialog
</message>
......@@ -3275,9 +3272,9 @@ are declared in build/common.gypi.
Media File Checker
</message>
</if>
<if expr="enable_print_preview">
<if expr="enable_print_preview or (enable_printing and is_win)">
<message name="IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME" desc="The name of the utility process used for printing conversions.">
Printing service
Printing Service
</message>
</if>
<message name="IDS_UTILITY_PROCESS_PATCH_NAME" desc="The name of the utility process used for patching file operations.">
......
......@@ -75,7 +75,6 @@
#include "chrome/browser/prerender/prerender_manager_factory.h"
#include "chrome/browser/prerender/prerender_message_filter.h"
#include "chrome/browser/prerender/prerender_util.h"
#include "chrome/browser/printing/printing_message_filter.h"
#include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_io_data.h"
......@@ -439,9 +438,12 @@
#endif
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/printing_message_filter.h"
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \
(BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN))
#include "chrome/services/printing/public/mojom/constants.mojom.h"
#endif
......@@ -3401,7 +3403,8 @@ void ChromeContentBrowserClient::RegisterOutOfProcessServices(
base::ASCIIToUTF16("PDF Compositor Service");
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \
(BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN))
(*services)[printing::mojom::kChromePrintingServiceName] =
l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME);
#endif
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module printing.mojom;
const string kChromePrintingServiceName = "chrome_printing";
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module printing.mojom;
const string kChromePrintingServiceName = "chrome_printing";
......@@ -39,7 +39,6 @@
#endif // !defined(OS_ANDROID)
#if defined(OS_WIN)
#include "chrome/services/printing/pdf_to_emf_converter_factory.h"
#include "chrome/services/util_win/public/mojom/constants.mojom.h"
#include "chrome/services/util_win/util_win_service.h"
#endif
......@@ -62,19 +61,24 @@
#include "chrome/utility/mash_service_factory.h"
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/common/chrome_content_client.h"
#include "components/printing/service/public/cpp/pdf_compositor_service_factory.h" // nogncheck
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" // nogncheck
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \
(BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN))
#include "chrome/services/printing/printing_service.h"
#include "chrome/services/printing/public/mojom/constants.mojom.h"
#endif
#if defined(OS_WIN) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
#include "chrome/utility/printing_handler.h"
#if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)
#include "chrome/services/printing/pdf_to_emf_converter_factory.h"
#endif
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/common/chrome_content_client.h"
#include "components/printing/service/public/cpp/pdf_compositor_service_factory.h" // nogncheck
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" // nogncheck
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && defined(OS_WIN)
#include "chrome/utility/printing_handler.h"
#endif
#if defined(FULL_SAFE_BROWSING) || defined(OS_CHROMEOS)
......@@ -102,7 +106,7 @@ void RegisterRemovableStorageWriterService(
ChromeContentUtilityClient::ChromeContentUtilityClient()
: utility_process_running_elevated_(false) {
#if defined(OS_WIN) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && defined(OS_WIN)
printing_handler_ = std::make_unique<printing::PrintingHandler>();
#endif
......@@ -132,7 +136,7 @@ void ChromeContentUtilityClient::UtilityThreadStarted() {
// If our process runs with elevated privileges, only add elevated Mojo
// interfaces to the interface registry.
if (!utility_process_running_elevated_) {
#if defined(OS_WIN)
#if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)
// TODO(crbug.com/798782): remove when the Cloud print chrome/service is
// removed.
registry->AddInterface(
......@@ -150,7 +154,7 @@ bool ChromeContentUtilityClient::OnMessageReceived(
if (utility_process_running_elevated_)
return false;
#if defined(OS_WIN) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && defined(OS_WIN)
if (printing_handler_->OnMessageReceived(message))
return true;
#endif
......@@ -178,7 +182,8 @@ void ChromeContentUtilityClient::RegisterServices(
services->emplace(printing::mojom::kServiceName, pdf_compositor_info);
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#if BUILDFLAG(ENABLE_PRINT_PREVIEW) || \
(BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN))
service_manager::EmbeddedServiceInfo printing_info;
printing_info.factory =
base::BindRepeating(&printing::PrintingService::CreateService);
......
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