Index: content/browser/download/mhtml_generation_manager.cc |
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc |
index c63405e93d55507e4e871dfa85c1ded7c295ae9f..5c4fce0ebe69bc0b9d4f0a39d19317d37aaa17e2 100644 |
--- a/content/browser/download/mhtml_generation_manager.cc |
+++ b/content/browser/download/mhtml_generation_manager.cc |
@@ -10,10 +10,8 @@ |
#include "base/bind.h" |
#include "base/files/file.h" |
#include "base/guid.h" |
-#include "base/rand_util.h" |
#include "base/scoped_observer.h" |
#include "base/stl_util.h" |
-#include "base/strings/string_number_conversions.h" |
#include "base/strings/stringprintf.h" |
#include "content/browser/frame_host/frame_tree_node.h" |
#include "content/common/frame_messages.h" |
@@ -22,6 +20,7 @@ |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/render_process_host_observer.h" |
#include "content/public/browser/web_contents.h" |
+#include "net/base/mime_util.h" |
namespace content { |
@@ -57,7 +56,6 @@ class MHTMLGenerationManager::Job : public RenderProcessHostObserver { |
void RenderProcessHostDestroyed(RenderProcessHost* host) override; |
private: |
- static std::string GenerateMHTMLBoundaryMarker(); |
static int64 CloseFileOnFileThread(base::File file); |
void AddFrame(RenderFrameHost* render_frame_host); |
@@ -98,7 +96,7 @@ MHTMLGenerationManager::Job::Job(int job_id, |
WebContents* web_contents, |
GenerateMHTMLCallback callback) |
: job_id_(job_id), |
- mhtml_boundary_marker_(GenerateMHTMLBoundaryMarker()), |
+ mhtml_boundary_marker_(net::GenerateMimeMultipartBoundary()), |
callback_(callback), |
observed_renderer_process_host_(this) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
@@ -214,25 +212,6 @@ int64 MHTMLGenerationManager::Job::CloseFileOnFileThread(base::File file) { |
return file_size; |
} |
-// static |
-std::string MHTMLGenerationManager::Job::GenerateMHTMLBoundaryMarker() { |
- // TODO(lukasza): Introduce and use a shared helper function in |
- // net/base/mime_util.h instead of having the ad-hoc code below. |
- |
- // Trying to generate random boundaries similar to IE/UnMHT |
- // (ex: ----=_NextPart_000_001B_01CC157B.96F808A0). |
- uint8_t random_values[10]; |
- base::RandBytes(&random_values, sizeof(random_values)); |
- |
- std::string result("----=_NextPart_000_"); |
- result += base::HexEncode(random_values + 0, 2); |
- result += '_'; |
- result += base::HexEncode(random_values + 2, 4); |
- result += '.'; |
- result += base::HexEncode(random_values + 6, 4); |
- return result; |
-} |
- |
MHTMLGenerationManager* MHTMLGenerationManager::GetInstance() { |
return base::Singleton<MHTMLGenerationManager>::get(); |
} |