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

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

Issue 15076008: Move AddMultipartValueForUpload to net/base/mime_util.h/cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 | « chrome/common/cloud_print/cloud_print_helpers.cc ('k') | chrome/service/cloud_print/printer_job_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/cloud_print_connector.cc
diff --git a/chrome/service/cloud_print/cloud_print_connector.cc b/chrome/service/cloud_print/cloud_print_connector.cc
index 0e2e0ec3b3c20889643af9fdc2bdf6f107a98818..54016b63f6573ab05ab2c19b572e253ffee5b609 100644
--- a/chrome/service/cloud_print/cloud_print_connector.cc
+++ b/chrome/service/cloud_print/cloud_print_connector.cc
@@ -17,6 +17,7 @@
#include "chrome/common/cloud_print/cloud_print_helpers.h"
#include "chrome/service/cloud_print/cloud_print_helpers.h"
#include "grit/generated_resources.h"
+#include "net/base/mime_util.h"
#include "ui/base/l10n/l10n_util.h"
namespace cloud_print {
@@ -313,10 +314,9 @@ void CloudPrintConnector::ReportUserMessage(const std::string& message_id,
CreateMimeBoundaryForUpload(&mime_boundary);
GURL url = GetUrlForUserMessage(settings_.server_url(), message_id);
std::string post_data;
- AddMultipartValueForUpload(kMessageTextValue, failure_msg, mime_boundary,
- std::string(), &post_data);
- // Terminate the request body
- post_data.append("--" + mime_boundary + "--\r\n");
+ net::AddMultipartValueForUpload(kMessageTextValue, failure_msg, mime_boundary,
+ std::string(), &post_data);
+ net::AddMultipartFinalDelimiterForUpload(mime_boundary, &post_data);
std::string mime_type("multipart/form-data; boundary=");
mime_type += mime_boundary;
user_message_request_ = CloudPrintURLFetcher::Create();
@@ -527,30 +527,28 @@ void CloudPrintConnector::OnReceivePrinterCaps(
CreateMimeBoundaryForUpload(&mime_boundary);
std::string post_data;
- AddMultipartValueForUpload(kProxyIdValue,
+ net::AddMultipartValueForUpload(kProxyIdValue,
settings_.proxy_id(), mime_boundary, std::string(), &post_data);
- AddMultipartValueForUpload(kPrinterNameValue,
+ net::AddMultipartValueForUpload(kPrinterNameValue,
info.printer_name, mime_boundary, std::string(), &post_data);
- AddMultipartValueForUpload(kPrinterDescValue,
+ net::AddMultipartValueForUpload(kPrinterDescValue,
info.printer_description, mime_boundary, std::string(), &post_data);
- AddMultipartValueForUpload(kPrinterStatusValue,
+ net::AddMultipartValueForUpload(kPrinterStatusValue,
base::StringPrintf("%d", info.printer_status),
mime_boundary, std::string(), &post_data);
post_data += GetPostDataForPrinterInfo(info, mime_boundary);
- AddMultipartValueForUpload(kPrinterCapsValue,
+ net::AddMultipartValueForUpload(kPrinterCapsValue,
caps_and_defaults.printer_capabilities, mime_boundary,
caps_and_defaults.caps_mime_type, &post_data);
- AddMultipartValueForUpload(kPrinterDefaultsValue,
+ net::AddMultipartValueForUpload(kPrinterDefaultsValue,
caps_and_defaults.printer_defaults, mime_boundary,
caps_and_defaults.defaults_mime_type, &post_data);
// Send a hash of the printer capabilities to the server. We will use this
// later to check if the capabilities have changed
- AddMultipartValueForUpload(kPrinterCapsHashValue,
+ net::AddMultipartValueForUpload(kPrinterCapsHashValue,
base::MD5String(caps_and_defaults.printer_capabilities),
mime_boundary, std::string(), &post_data);
-
- // Terminate the request body
- post_data.append("--" + mime_boundary + "--\r\n");
+ net::AddMultipartFinalDelimiterForUpload(mime_boundary, &post_data);
std::string mime_type("multipart/form-data; boundary=");
mime_type += mime_boundary;
« no previous file with comments | « chrome/common/cloud_print/cloud_print_helpers.cc ('k') | chrome/service/cloud_print/printer_job_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698