Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2124)

Unified Diff: chrome/service/cloud_print/print_system_win.cc

Issue 2904353002: CHECK XPS initialization succeeds on Windows. (Closed)
Patch Set: MakeUnique instead Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | printing/backend/print_backend_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/print_system_win.cc
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc
index d299ac9b3e60d186efdb6e731603550ea31242fa..2cc2aaba139e3281f711c2fe089c43e321e85e6c 100644
--- a/chrome/service/cloud_print/print_system_win.cc
+++ b/chrome/service/cloud_print/print_system_win.cc
@@ -720,17 +720,18 @@ bool PrintSystemWin::ValidatePrintTicket(
DCHECK(print_ticket_data_mime_type == kContentTypeXML);
printing::ScopedXPSInitializer xps_initializer;
- if (!xps_initializer.initialized()) {
- // TODO(sanjeevr): Handle legacy proxy case (with no prntvpt.dll)
- return false;
- }
- bool ret = false;
- HPTPROVIDER provider = NULL;
+ CHECK(xps_initializer.initialized());
+
+ HPTPROVIDER provider = nullptr;
printing::XPSModule::OpenProvider(base::UTF8ToWide(printer_name), 1,
&provider);
- if (provider) {
+ if (!provider)
+ return false;
+
+ bool ret;
+ {
base::win::ScopedComPtr<IStream> print_ticket_stream;
- CreateStreamOnHGlobal(NULL, TRUE, print_ticket_stream.GetAddressOf());
+ CreateStreamOnHGlobal(nullptr, TRUE, print_ticket_stream.GetAddressOf());
ULONG bytes_written = 0;
print_ticket_stream->Write(print_ticket_data.c_str(),
print_ticket_data.length(),
@@ -741,14 +742,10 @@ bool PrintSystemWin::ValidatePrintTicket(
print_ticket_stream->Seek(pos, STREAM_SEEK_SET, &new_pos);
base::win::ScopedBstr error;
base::win::ScopedComPtr<IStream> result_ticket_stream;
- CreateStreamOnHGlobal(NULL, TRUE, result_ticket_stream.GetAddressOf());
+ CreateStreamOnHGlobal(nullptr, TRUE, result_ticket_stream.GetAddressOf());
ret = SUCCEEDED(printing::XPSModule::MergeAndValidatePrintTicket(
- provider,
- print_ticket_stream.Get(),
- NULL,
- kPTJobScope,
- result_ticket_stream.Get(),
- error.Receive()));
+ provider, print_ticket_stream.Get(), nullptr, kPTJobScope,
+ result_ticket_stream.Get(), error.Receive()));
printing::XPSModule::CloseProvider(provider);
}
return ret;
« no previous file with comments | « no previous file | printing/backend/print_backend_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698