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

Unified Diff: chrome/browser/local_discovery/privet_http_impl.cc

Issue 72033002: Added the ability to set the upload file path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
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,
« no previous file with comments | « chrome/browser/local_discovery/privet_http_impl.h ('k') | chrome/browser/local_discovery/privet_http_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698