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 48d65df6ca051514284efce7adc2ea4e3f4fd858..af5fba17835d658058bab6d3dab4a711c6bacf6b 100644 |
--- a/chrome/browser/local_discovery/privet_http_impl.cc |
+++ b/chrome/browser/local_discovery/privet_http_impl.cc |
@@ -489,10 +489,20 @@ 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( |
gene
2013/11/14 00:52:14
nit: fit on one line
Noam Samuel
2013/11/14 19:05:57
Done.
|
+ content_type, |
+ data_file_); |
+ } else { |
+ url_fetcher_->SetUploadData( |
gene
2013/11/14 00:52:14
nit: fit on one line
Noam Samuel
2013/11/14 19:05:57
Done.
|
+ content_type, |
+ data_); |
+ } |
url_fetcher_->Start(); |
} |
@@ -613,13 +623,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) { |
@@ -642,6 +658,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, |