diff options
author | Michael Bruning <michael.bruning@theqtcompany.com> | 2016-01-15 11:26:31 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-03-16 15:19:39 +0100 |
commit | 9254aa22aea55ca7b65a6e8783da00ee9bc2ddf8 (patch) | |
tree | cad00cbcac9ac991383f14454bf0c25b0da05e87 | |
parent | cb908ba55ac166b8d2529f6c62b11a4658fa3883 (diff) | |
download | qtwebengine-chromium-9254aa22aea55ca7b65a6e8783da00ee9bc2ddf8.tar.gz |
Fix printing sources for Qt and add them to the build.
Change-Id: I3c28afbbcc57f43b47ce055db7421abaca1fef63
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r-- | chromium/chrome/browser/printing/print_job.cc | 12 | ||||
-rw-r--r-- | chromium/chrome/browser/printing/print_job.h | 8 | ||||
-rw-r--r-- | chromium/chrome/browser/printing/print_job_worker.cc | 16 | ||||
-rw-r--r-- | chromium/components/printing/renderer/print_render_frame_helper.cc | 2 | ||||
-rw-r--r-- | chromium/ui/display/screen.cc | 2 |
5 files changed, 28 insertions, 12 deletions
diff --git a/chromium/chrome/browser/printing/print_job.cc b/chromium/chrome/browser/printing/print_job.cc index a5b0e4ff00b..997362290dc 100644 --- a/chromium/chrome/browser/printing/print_job.cc +++ b/chromium/chrome/browser/printing/print_job.cc @@ -25,6 +25,7 @@ #include "printing/printed_document.h" #if defined(OS_WIN) +#if !defined(TOOLKIT_QT) #include "base/command_line.h" #include "chrome/browser/printing/pdf_to_emf_converter.h" #include "chrome/browser/profiles/profile.h" @@ -33,6 +34,7 @@ #include "components/prefs/pref_service.h" #include "content/public/browser/web_contents.h" #include "printing/pdf_render_settings.h" +#endif #include "printing/printed_page_win.h" #include "printing/printing_features.h" #endif @@ -95,7 +97,7 @@ void PrintJob::Initialize(std::unique_ptr<PrinterQuery> query, worker_->SetPrintJob(this); std::unique_ptr<PrintSettings> settings = query->ExtractSettings(); -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) pdf_page_mapping_ = PageRange::GetPages(settings->ranges()); if (pdf_page_mapping_.empty()) { for (uint32_t i = 0; i < page_count; i++) @@ -113,7 +115,7 @@ void PrintJob::Initialize(std::unique_ptr<PrinterQuery> query, content::Source<PrintJob>(this)); } -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) // static std::vector<uint32_t> PrintJob::GetFullPageMapping( const std::vector<uint32_t>& pages, @@ -286,7 +288,7 @@ const std::string& PrintJob::source_id() const { } #endif // defined(OS_CHROMEOS) -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) class PrintJob::PdfConversionState { public: PdfConversionState(const gfx::Size& page_size, const gfx::Rect& content_area) @@ -459,7 +461,7 @@ void PrintJob::StartPdfToPostScriptConversion( bytes, render_settings, base::BindOnce(&PrintJob::OnPdfConversionStarted, this)); } -#endif // defined(OS_WIN) +#endif // OS_WIN && !defined(TOOLKIT_QT) void PrintJob::UpdatePrintedDocument( scoped_refptr<PrintedDocument> new_document) { @@ -521,7 +523,7 @@ void PrintJob::OnNotifyPrintJobEvent(const JobEventDetails& event_details) { FROM_HERE, base::BindOnce(&PrintJob::OnDocumentDone, this)); break; } -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) case JobEventDetails::PAGE_DONE: if (pdf_conversion_state_) { pdf_conversion_state_->OnPageProcessed( diff --git a/chromium/chrome/browser/printing/print_job.h b/chromium/chrome/browser/printing/print_job.h index beb577a7fd2..f8bed4bf695 100644 --- a/chromium/chrome/browser/printing/print_job.h +++ b/chromium/chrome/browser/printing/print_job.h @@ -69,7 +69,7 @@ class PrintJob : public base::RefCountedThreadSafe<PrintJob>, const base::string16& name, uint32_t page_count); -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) void StartConversionToNativeFormat( scoped_refptr<base::RefCountedMemory> print_data, const gfx::Size& page_size, @@ -172,7 +172,7 @@ class PrintJob : public base::RefCountedThreadSafe<PrintJob>, void HoldUntilStopIsCalled(); -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) virtual void StartPdfToEmfConversion( scoped_refptr<base::RefCountedMemory> bytes, const gfx::Size& page_size, @@ -216,11 +216,11 @@ class PrintJob : public base::RefCountedThreadSafe<PrintJob>, // the notified calls Cancel() again. bool is_canceling_ = false; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) class PdfConversionState; std::unique_ptr<PdfConversionState> pdf_conversion_state_; std::vector<uint32_t> pdf_page_mapping_; -#endif // defined(OS_WIN) +#endif // defined(OS_WIN) && !defined(TOOLKIT_QT) #if defined(OS_CHROMEOS) // The component which initiated the print job. diff --git a/chromium/chrome/browser/printing/print_job_worker.cc b/chromium/chrome/browser/printing/print_job_worker.cc index 8e648fa8d56..42c3253e44a 100644 --- a/chromium/chrome/browser/printing/print_job_worker.cc +++ b/chromium/chrome/browser/printing/print_job_worker.cc @@ -18,7 +18,6 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "build/build_config.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/printing/print_job.h" #include "chrome/grit/generated_resources.h" @@ -34,11 +33,20 @@ #include "printing/printing_utils.h" #include "ui/base/l10n/l10n_util.h" +#if !defined(TOOLKIT_QT) +#include "chrome/browser/browser_process.h" +#include "chrome/common/features.h" + #if defined(OS_ANDROID) #include "chrome/browser/android/tab_android.h" #include "chrome/browser/android/tab_printer.h" #include "printing/printing_context_android.h" #endif +#else // !defined(TOOLKIT_QT) +namespace printing { +std::string getApplicationLocale(); +} +#endif #if defined(OS_WIN) #include "base/threading/thread_restrictions.h" @@ -94,7 +102,11 @@ content::WebContents* PrintingContextDelegate::GetWebContents() { } std::string PrintingContextDelegate::GetAppLocale() { +#if defined(TOOLKIT_QT) + return getApplicationLocale(); +#else return g_browser_process->GetApplicationLocale(); +#endif // if defined(TOOLKIT_QT) } void NotificationCallback(PrintJob* print_job, @@ -218,7 +230,7 @@ void PrintJobWorker::UpdatePrintSettings(base::Value new_settings, base::ScopedAllowBlocking allow_blocking; #endif scoped_refptr<PrintBackend> print_backend = - PrintBackend::CreateInstance(g_browser_process->GetApplicationLocale()); + PrintBackend::CreateInstance(getApplicationLocale()); std::string printer_name = *new_settings.FindStringKey(kSettingDeviceName); crash_key = std::make_unique<crash_keys::ScopedPrinterInfo>( print_backend->GetPrinterDriverInfo(printer_name)); diff --git a/chromium/components/printing/renderer/print_render_frame_helper.cc b/chromium/components/printing/renderer/print_render_frame_helper.cc index cd78b5f301b..fe0c25f2a0e 100644 --- a/chromium/components/printing/renderer/print_render_frame_helper.cc +++ b/chromium/components/printing/renderer/print_render_frame_helper.cc @@ -658,6 +658,7 @@ void PrintRenderFrameHelper::PrintHeaderAndFooter( float webkit_scale_factor, const mojom::PageSizeMargins& page_layout, const mojom::PrintParams& params) { +#if !defined(TOOLKIT_QT) DCHECK_LE(total_pages, kMaxPageCount); // |page_number| is 1-based here, so it could be equal to kMaxPageCount. DCHECK_LE(page_number, kMaxPageCount); @@ -753,6 +754,7 @@ void PrintRenderFrameHelper::PrintHeaderAndFooter( frame->PrintEnd(); web_view->Close(); +#endif // !defined(TOOLKIT_QT) } // static - Not anonymous so that platform implementations can use it. diff --git a/chromium/ui/display/screen.cc b/chromium/ui/display/screen.cc index 95588119d57..cbe37e0466b 100644 --- a/chromium/ui/display/screen.cc +++ b/chromium/ui/display/screen.cc @@ -17,7 +17,7 @@ namespace display { namespace { -Screen* g_screen; +Screen* g_screen = nullptr; } // namespace |