| Index: chrome/browser/local_discovery/privet_http_impl.cc
|
| diff --git a/chrome/browser/local_discovery/privet_http_impl.cc b/chrome/browser/local_discovery/privet_http_impl.cc
|
| index 9592fc6455dda349a525f50b5f20fe0083be8afe..4a56f4f12de0b053f9daf03448221bc669917393 100644
|
| --- a/chrome/browser/local_discovery/privet_http_impl.cc
|
| +++ b/chrome/browser/local_discovery/privet_http_impl.cc
|
| @@ -487,10 +487,16 @@ void PrivetLocalPrintOperationImpl::DoSubmitdoc() {
|
| url_fetcher_= privet_client_->CreateURLFetcher(
|
| url, net::URLFetcher::POST, this);
|
|
|
| - DCHECK(!data_.empty());
|
| - url_fetcher_->SetUploadData(
|
| - use_pdf_ ? kPrivetContentTypePDF : kPrivetContentTypePWGRaster,
|
| - data_);
|
| + std::string content_type =
|
| + use_pdf_ ? kPrivetContentTypePDF : kPrivetContentTypePWGRaster;
|
| +
|
| + DCHECK(!data_.empty() || !data_file_.empty());
|
| +
|
| + if (!data_file_.empty()) {
|
| + url_fetcher_->SetUploadFilePath(content_type, data_file_);
|
| + } else {
|
| + url_fetcher_->SetUploadData(content_type, data_);
|
| + }
|
|
|
| url_fetcher_->Start();
|
| }
|
| @@ -609,13 +615,19 @@ void PrivetLocalPrintOperationImpl::OnNeedPrivetToken(
|
|
|
| void PrivetLocalPrintOperationImpl::SendData(const std::string& data) {
|
| DCHECK(started_);
|
| + DCHECK(data_file_.empty());
|
| data_ = data;
|
|
|
| - if (has_extended_workflow_ && !ticket_.empty()) {
|
| - DoCreatejob();
|
| - } else {
|
| - DoSubmitdoc();
|
| - }
|
| + SendDataInternal();
|
| +}
|
| +
|
| +void PrivetLocalPrintOperationImpl::SendDataFile(
|
| + const base::FilePath& data_file) {
|
| + DCHECK(started_);
|
| + DCHECK(data_.empty());
|
| + data_file_ = data_file;
|
| +
|
| + SendDataInternal();
|
| }
|
|
|
| void PrivetLocalPrintOperationImpl::SetTicket(const std::string& ticket) {
|
| @@ -638,6 +650,14 @@ void PrivetLocalPrintOperationImpl::SetOffline(bool offline) {
|
| offline_ = offline;
|
| }
|
|
|
| +void PrivetLocalPrintOperationImpl::SendDataInternal() {
|
| + if (has_extended_workflow_ && !ticket_.empty()) {
|
| + DoCreatejob();
|
| + } else {
|
| + DoSubmitdoc();
|
| + }
|
| +}
|
| +
|
| PrivetHTTPClientImpl::PrivetHTTPClientImpl(
|
| const std::string& name,
|
| const net::HostPortPair& host_port,
|
|
|