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

Side by Side Diff: content/renderer/mhtml_generator.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/menu_item_builder.cc ('k') | content/renderer/mouse_lock_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/mhtml_generator.h" 5 #include "content/renderer/mhtml_generator.h"
6 6
7 #include "base/platform_file.h" 7 #include "base/platform_file.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "content/renderer/render_view_impl.h" 9 #include "content/renderer/render_view_impl.h"
10 #include "third_party/WebKit/public/platform/WebCString.h" 10 #include "third_party/WebKit/public/platform/WebCString.h"
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 void MHTMLGenerator::NotifyBrowser(int job_id, int64 data_size) { 43 void MHTMLGenerator::NotifyBrowser(int job_id, int64 data_size) {
44 render_view()->Send(new ViewHostMsg_SavedPageAsMHTML(job_id, data_size)); 44 render_view()->Send(new ViewHostMsg_SavedPageAsMHTML(job_id, data_size));
45 file_ = base::kInvalidPlatformFileValue; 45 file_ = base::kInvalidPlatformFileValue;
46 } 46 }
47 47
48 // TODO(jcivelli): write the chunks in deferred tasks to give a chance to the 48 // TODO(jcivelli): write the chunks in deferred tasks to give a chance to the
49 // message loop to process other events. 49 // message loop to process other events.
50 int64 MHTMLGenerator::GenerateMHTML() { 50 int64 MHTMLGenerator::GenerateMHTML() {
51 WebKit::WebCString mhtml = 51 blink::WebCString mhtml =
52 WebKit::WebPageSerializer::serializeToMHTML(render_view()->GetWebView()); 52 blink::WebPageSerializer::serializeToMHTML(render_view()->GetWebView());
53 const size_t chunk_size = 1024; 53 const size_t chunk_size = 1024;
54 const char* data = mhtml.data(); 54 const char* data = mhtml.data();
55 size_t total_bytes_written = 0; 55 size_t total_bytes_written = 0;
56 while (total_bytes_written < mhtml.length()) { 56 while (total_bytes_written < mhtml.length()) {
57 size_t copy_size = 57 size_t copy_size =
58 std::min(mhtml.length() - total_bytes_written, chunk_size); 58 std::min(mhtml.length() - total_bytes_written, chunk_size);
59 int bytes_written = base::WritePlatformFile(file_, total_bytes_written, 59 int bytes_written = base::WritePlatformFile(file_, total_bytes_written,
60 data + total_bytes_written, 60 data + total_bytes_written,
61 copy_size); 61 copy_size);
62 if (bytes_written == -1) 62 if (bytes_written == -1)
63 return -1; 63 return -1;
64 total_bytes_written += bytes_written; 64 total_bytes_written += bytes_written;
65 } 65 }
66 return total_bytes_written; 66 return total_bytes_written;
67 } 67 }
68 68
69 } // namespace content 69 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/menu_item_builder.cc ('k') | content/renderer/mouse_lock_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698