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

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 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,
« 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