Commit f537167a authored by vitalybuka's avatar vitalybuka Committed by Commit bot

Fix compilation on Windows with enable_printing=2.

BUG=374321
NOTRY=true

Review URL: https://codereview.chromium.org/552703002

Cr-Commit-Position: refs/heads/master@{#293820}
parent 597255e6
......@@ -114,6 +114,7 @@ class TabsAddedNotificationObserver
DISALLOW_COPY_AND_ASSIGN(TabsAddedNotificationObserver);
};
#if defined(ENABLE_FULL_PRINTING)
class ScopedPreviewTestingDelegate : PrintPreviewUI::TestingDelegate {
public:
explicit ScopedPreviewTestingDelegate(bool auto_cancel)
......@@ -169,6 +170,8 @@ class ScopedPreviewTestingDelegate : PrintPreviewUI::TestingDelegate {
gfx::Size dialog_size_;
};
#endif // ENABLE_FULL_PRINTING
#if !defined(OS_CHROMEOS) && !defined(OS_WIN)
bool CopyTestDataAndSetCommandLineArg(
const base::FilePath& test_data_file,
......@@ -1110,6 +1113,9 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) {
->HasFocus());
}
#if defined(ENABLE_FULL_PRINTING)
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX)
#define MAYBE_WindowDotPrintShouldBringUpPrintPreview \
DISABLED_WindowDotPrintShouldBringUpPrintPreview
......@@ -1159,6 +1165,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
minimum_dialog_size.height());
GetFirstAppWindow()->GetBaseWindow()->Close();
}
#endif // ENABLE_FULL_PRINTING
#if defined(OS_CHROMEOS)
......
......@@ -24,7 +24,6 @@
#include "chrome/browser/first_run/upgrade_util.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/service_process/service_process_control.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/crash_keys.h"
......@@ -47,6 +46,10 @@
#include "chrome/browser/chromeos/boot_times_loader.h"
#endif
#if defined(ENABLE_FULL_PRINTING)
#include "chrome/browser/service_process/service_process_control.h"
#endif
using base::Time;
using base::TimeDelta;
using content::BrowserThread;
......@@ -140,9 +143,10 @@ bool ShutdownPreThreadsStop() {
chromeos::BootTimesLoader::Get()->AddLogoutTimeMarker(
"BrowserShutdownStarted", false);
#endif
#if defined(ENABLE_FULL_PRINTING)
// Shutdown the IPC channel to the service processes.
ServiceProcessControl::GetInstance()->Disconnect();
#endif // ENABLE_FULL_PRINTING
// WARNING: During logoff/shutdown (WM_ENDSESSION) we may not have enough
// time to get here. If you have something that *must* happen on end session,
......
......@@ -9,7 +9,6 @@
#include "base/callback.h"
#include "chrome/browser/local_discovery/privet_url_fetcher.h"
#include "chrome/browser/local_discovery/pwg_raster_converter.h"
#include "net/base/host_port_pair.h"
namespace base {
......@@ -26,6 +25,7 @@ class PdfRenderSettings;
namespace local_discovery {
class PWGRasterConverter;
class PrivetHTTPClient;
// Represents a simple request that returns pure JSON.
......@@ -208,7 +208,6 @@ class PrivetV1HTTPClient {
// Creates operation to submit print job to local printer.
virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation(
PrivetLocalPrintOperation::Delegate* delegate) = 0;
};
} // namespace local_discovery
......
......@@ -21,6 +21,10 @@
#include "ui/gfx/text_elider.h"
#include "url/gurl.h"
#if defined(ENABLE_FULL_PRINTING)
#include "chrome/browser/local_discovery/pwg_raster_converter.h"
#endif // ENABLE_FULL_PRINTING
using namespace cloud_devices::printer;
namespace cloud_print {
......@@ -34,6 +38,9 @@ const char kUrlPlaceHolder[] = "http://host/";
const char kPrivetRegisterActionArgName[] = "action";
const char kPrivetRegisterUserArgName[] = "user";
const int kPrivetCancelationTimeoutSeconds = 3;
#if defined(ENABLE_FULL_PRINTING)
const char kPrivetURLKeyUserName[] = "user_name";
const char kPrivetURLKeyClientName[] = "client_name";
const char kPrivetURLKeyJobname[] = "job_name";
......@@ -47,13 +54,11 @@ const char kPrivetContentTypeAny[] = "*/*";
const char kPrivetKeyJobID[] = "job_id";
const int kPrivetCancelationTimeoutSeconds = 3;
const int kPrivetLocalPrintMaxRetries = 2;
const int kPrivetLocalPrintDefaultTimeout = 5;
const size_t kPrivetLocalPrintMaxJobNameLength = 64;
#endif // ENABLE_FULL_PRINTING
GURL CreatePrivetURL(const std::string& path) {
GURL url(kUrlPlaceHolder);
......@@ -460,6 +465,7 @@ bool PrivetDataReadOperationImpl::OnRawData(PrivetURLFetcher* fetcher,
return true;
}
#if defined(ENABLE_FULL_PRINTING)
PrivetLocalPrintOperationImpl::PrivetLocalPrintOperationImpl(
PrivetHTTPClient* privet_client,
PrivetLocalPrintOperation::Delegate* delegate)
......@@ -819,6 +825,7 @@ void PrivetLocalPrintOperationImpl::SetPWGRasterConverterForTesting(
scoped_ptr<PWGRasterConverter> pwg_raster_converter) {
pwg_raster_converter_ = pwg_raster_converter.Pass();
}
#endif // ENABLE_FULL_PRINTING
PrivetHTTPClientImpl::PrivetHTTPClientImpl(
const std::string& name,
......@@ -921,8 +928,12 @@ PrivetV1HTTPClientImpl::CreateCapabilitiesOperation(
scoped_ptr<PrivetLocalPrintOperation>
PrivetV1HTTPClientImpl::CreateLocalPrintOperation(
PrivetLocalPrintOperation::Delegate* delegate) {
#if defined(ENABLE_FULL_PRINTING)
return scoped_ptr<PrivetLocalPrintOperation>(
new PrivetLocalPrintOperationImpl(info_client(), delegate));
#else
return scoped_ptr<PrivetLocalPrintOperation>();
#endif // ENABLE_FULL_PRINTING
}
} // namespace local_discovery
......@@ -6,6 +6,7 @@
#define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_IMPL_H_
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/files/file_util.h"
......@@ -193,6 +194,7 @@ class PrivetDataReadOperationImpl : public PrivetDataReadOperation,
scoped_ptr<PrivetURLFetcher> url_fetcher_;
};
#if defined(ENABLE_FULL_PRINTING)
class PrivetLocalPrintOperationImpl
: public PrivetLocalPrintOperation,
public PrivetURLFetcher::Delegate {
......@@ -282,6 +284,7 @@ class PrivetLocalPrintOperationImpl
base::WeakPtrFactory<PrivetLocalPrintOperationImpl> weak_factory_;
};
#endif // ENABLE_FULL_PRINTING
class PrivetHTTPClientImpl : public PrivetHTTPClient {
public:
......
......@@ -43,7 +43,9 @@
#if defined(OS_ANDROID)
#include "chrome/browser/metrics/android_metrics_provider.h"
#else
#endif
#if defined(ENABLE_FULL_PRINTING)
#include "chrome/browser/service_process/service_process_control.h"
#endif
......@@ -394,10 +396,9 @@ void ChromeMetricsServiceClient::OnMemoryDetailCollectionDone() {
DCHECK_EQ(num_async_histogram_fetches_in_progress_, 0);
#if defined(OS_ANDROID)
// Android has no service process.
#if !defined(ENABLE_FULL_PRINTING)
num_async_histogram_fetches_in_progress_ = 1;
#else // OS_ANDROID
#else // !ENABLE_FULL_PRINTING
num_async_histogram_fetches_in_progress_ = 2;
// Run requests to service and content in parallel.
if (!ServiceProcessControl::GetInstance()->GetHistograms(callback, timeout)) {
......@@ -408,7 +409,7 @@ void ChromeMetricsServiceClient::OnMemoryDetailCollectionDone() {
// here to make code work even if |GetHistograms()| fired |callback|.
--num_async_histogram_fetches_in_progress_;
}
#endif // OS_ANDROID
#endif // !ENABLE_FULL_PRINTING
// Set up the callback to task to call after we receive histograms from all
// child processes. |timeout| specifies how long to wait before absolutely
......
......@@ -253,10 +253,12 @@ TaskManagerModel::TaskManagerModel(TaskManager* task_manager)
task_manager,
scoped_ptr<WebContentsInformation>(
new task_manager::TabContentsInformation())));
#if defined(ENABLE_FULL_PRINTING)
AddResourceProvider(new task_manager::WebContentsResourceProvider(
task_manager,
scoped_ptr<WebContentsInformation>(
new task_manager::PrintingInformation())));
#endif // ENABLE_FULL_PRINTING
AddResourceProvider(new task_manager::WebContentsResourceProvider(
task_manager,
scoped_ptr<WebContentsInformation>(
......
......@@ -69,8 +69,10 @@ int StringForChromeHost(const GURL& url) {
return IDS_PLUGINS_TITLE;
if (host == chrome::kChromeUIPolicyHost)
return IDS_POLICY_TITLE;
#if defined(ENABLE_FULL_PRINTING)
if (host == chrome::kChromeUIPrintHost)
return IDS_PRINT_PREVIEW_TITLE;
#endif // ENABLE_FULL_PRINTING
if (host == chrome::kChromeUISettingsHost)
return IDS_SETTINGS_TITLE;
if (host == chrome::kChromeUIVersionHost)
......
......@@ -1854,8 +1854,6 @@
],
# Used on top of the "basic" sources when enable_printing == 1 (full).
'chrome_browser_full_printing_sources': [
'browser/local_discovery/privet_http_impl.cc',
'browser/local_discovery/privet_http_impl.h',
'browser/local_discovery/pwg_raster_converter.cc',
'browser/local_discovery/pwg_raster_converter.h',
'browser/printing/background_printing_manager.cc',
......@@ -2388,6 +2386,8 @@
'browser/local_discovery/privet_http_asynchronous_factory.h',
'browser/local_discovery/privet_http_asynchronous_factory_mac.cc',
'browser/local_discovery/privet_http_asynchronous_factory_mac.h',
'browser/local_discovery/privet_http_impl.cc',
'browser/local_discovery/privet_http_impl.h',
'browser/local_discovery/privet_local_printer_lister.cc',
'browser/local_discovery/privet_local_printer_lister.h',
'browser/local_discovery/privet_notifications.cc',
......
......@@ -2078,6 +2078,7 @@
['exclude', '^browser/printing/cloud_print/test/.*'],
['exclude', '^browser/printing/print_preview_dialog_controller_browsertest.cc'],
['exclude', '^browser/printing/print_preview_pdf_generated_browsertest.cc'],
['exclude', '^browser/service_process/service_process_control_browsertest.cc'],
['exclude', '^browser/ui/webui/print_preview/print_preview_ui_browsertest.cc'],
['exclude', '^renderer/printing/print_web_view_helper_browsertest.cc'],
['exclude', '^test/data/webui/print_preview.cc'],
......
......@@ -2268,9 +2268,6 @@
['exclude', '^common/service_'],
['exclude', '^service/'],
],
'sources!': [
'browser/local_discovery/privet_http_unittest.cc',
],
}],
['enable_captive_portal_detection!=1', {
'sources/': [
......
......@@ -14,12 +14,10 @@
#include "printing/pdf_render_settings.h"
#include "printing/pwg_raster_settings.h"
#if !defined(ENABLE_FULL_PRINTING)
#error "Full printing must be enabled"
#endif
#define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart
#if defined(ENABLE_FULL_PRINTING)
IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults)
IPC_STRUCT_TRAITS_MEMBER(printer_capabilities)
IPC_STRUCT_TRAITS_MEMBER(caps_mime_type)
......@@ -85,17 +83,6 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterSemanticCapsAndDefaults,
std::string /* printer name */)
#if defined(OS_WIN)
// Tell the utility process to render the given PDF into a metafile.
// The metafile path will have ".%d" inserted where the %d is the page number.
// If no page range is specified, all pages will be converted.
IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
IPC::PlatformFileForTransit, // PDF file
base::FilePath, // Base location for output metafile
printing::PdfRenderSettings, // PDF render settings
std::vector<printing::PageRange>)
#endif // OS_WIN
//------------------------------------------------------------------------------
// Utility process host messages:
// These are messages from the utility process to the browser.
......@@ -130,7 +117,18 @@ IPC_MESSAGE_CONTROL1(
ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed,
std::string /* printer name */)
#endif // ENABLE_FULL_PRINTING
#if defined(OS_WIN)
// Tell the utility process to render the given PDF into a metafile.
// The metafile path will have ".%d" inserted where the %d is the page number.
// If no page range is specified, all pages will be converted.
IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToMetafiles,
IPC::PlatformFileForTransit, // PDF file
base::FilePath, // Base location for output metafile
printing::PdfRenderSettings, // PDF render settings
std::vector<printing::PageRange>)
// Reply when the utility process has succeeded in rendering the PDF.
IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_Succeeded,
std::vector<printing::PageRange>, // Pages rendered
......@@ -138,4 +136,5 @@ IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_Succeeded,
// Reply when an error occurred rendering the PDF.
IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Failed)
#endif // OS_WIN
......@@ -24,11 +24,11 @@
#endif
#if defined(ENABLE_FULL_PRINTING)
#include "chrome/common/chrome_utility_printing_messages.h"
#include "chrome/common/service_messages.h"
#endif
#if defined(ENABLE_PRINTING)
#include "chrome/common/chrome_utility_printing_messages.h"
#include "chrome/common/print_messages.h"
#endif
......
......@@ -221,7 +221,6 @@ const char kChromeUIProfileSigninConfirmationHost[] =
"profile-signin-confirmation";
const char kChromeUIUserManagerHost[] = "user-manager";
const char kChromeUIPredictorsHost[] = "predictors";
const char kChromeUIPrintHost[] = "print";
const char kChromeUIProfilerHost[] = "profiler";
const char kChromeUIQuotaInternalsHost[] = "quota-internals";
const char kChromeUIQuitHost[] = "quit";
......@@ -259,6 +258,10 @@ const char kChromeUIWorkersHost[] = "workers";
const char kChromeUIScreenshotPath[] = "screenshots";
const char kChromeUIThemePath[] = "theme";
#if defined(ENABLE_FULL_PRINTING)
const char kChromeUIPrintHost[] = "print";
#endif // ENABLE_FULL_PRINTING
#if defined(OS_ANDROID)
const char kChromeUIWelcomeHost[] = "welcome";
#endif
......
......@@ -208,7 +208,6 @@ extern const char kChromeUIProfileSigninConfirmationHost[];
extern const char kChromeUIProvidedFileSystemsHost[];
extern const char kChromeUIUserManagerHost[];
extern const char kChromeUIPredictorsHost[];
extern const char kChromeUIPrintHost[];
extern const char kChromeUIProfilerHost[];
extern const char kChromeUIQuotaInternalsHost[];
extern const char kChromeUIQuitHost[];
......@@ -246,6 +245,10 @@ extern const char kChromeUIWorkersHost[];
extern const char kChromeUIScreenshotPath[];
extern const char kChromeUIThemePath[];
#if defined(ENABLE_FULL_PRINTING)
extern const char kChromeUIPrintHost[];
#endif // ENABLE_FULL_PRINTING
#if defined(OS_ANDROID)
extern const char kChromeUIWelcomeHost[];
#endif
......
......@@ -266,7 +266,7 @@ bool TestingBrowserProcess::IsShuttingDown() {
}
printing::PrintJobManager* TestingBrowserProcess::print_job_manager() {
#if defined(ENABLE_FULL_PRINTING)
#if defined(ENABLE_PRINTING)
if (!print_job_manager_.get())
print_job_manager_.reset(new printing::PrintJobManager());
return print_job_manager_.get();
......
......@@ -155,8 +155,11 @@ class TestingBrowserProcess : public BrowserProcess {
scoped_ptr<ProfileManager> profile_manager_;
scoped_ptr<NotificationUIManager> notification_ui_manager_;
#if defined(ENABLE_FULL_PRINTING)
#if defined(ENABLE_PRINTING)
scoped_ptr<printing::PrintJobManager> print_job_manager_;
#endif
#if defined(ENABLE_FULL_PRINTING)
scoped_ptr<printing::BackgroundPrintingManager> background_printing_manager_;
scoped_refptr<printing::PrintPreviewDialogController>
print_preview_dialog_controller_;
......
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