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

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

Issue 1947263004: Introduces a new MHTML generation parameter specifying different behvaior for cache-control headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Łukasz comments. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "content/common/ssl_status_serialization.h" 62 #include "content/common/ssl_status_serialization.h"
63 #include "content/common/swapped_out_messages.h" 63 #include "content/common/swapped_out_messages.h"
64 #include "content/common/view_messages.h" 64 #include "content/common/view_messages.h"
65 #include "content/public/common/bindings_policy.h" 65 #include "content/public/common/bindings_policy.h"
66 #include "content/public/common/browser_side_navigation_policy.h" 66 #include "content/public/common/browser_side_navigation_policy.h"
67 #include "content/public/common/content_constants.h" 67 #include "content/public/common/content_constants.h"
68 #include "content/public/common/content_features.h" 68 #include "content/public/common/content_features.h"
69 #include "content/public/common/content_switches.h" 69 #include "content/public/common/content_switches.h"
70 #include "content/public/common/context_menu_params.h" 70 #include "content/public/common/context_menu_params.h"
71 #include "content/public/common/isolated_world_ids.h" 71 #include "content/public/common/isolated_world_ids.h"
72 #include "content/public/common/mhtml_generation.h"
72 #include "content/public/common/page_state.h" 73 #include "content/public/common/page_state.h"
73 #include "content/public/common/resource_response.h" 74 #include "content/public/common/resource_response.h"
74 #include "content/public/common/url_constants.h" 75 #include "content/public/common/url_constants.h"
75 #include "content/public/common/url_utils.h" 76 #include "content/public/common/url_utils.h"
76 #include "content/public/renderer/browser_plugin_delegate.h" 77 #include "content/public/renderer/browser_plugin_delegate.h"
77 #include "content/public/renderer/content_renderer_client.h" 78 #include "content/public/renderer/content_renderer_client.h"
78 #include "content/public/renderer/context_menu_client.h" 79 #include "content/public/renderer/context_menu_client.h"
79 #include "content/public/renderer/document_state.h" 80 #include "content/public/renderer/document_state.h"
80 #include "content/public/renderer/navigation_state.h" 81 #include "content/public/renderer/navigation_state.h"
81 #include "content/public/renderer/render_frame_observer.h" 82 #include "content/public/renderer/render_frame_observer.h"
(...skipping 4817 matching lines...) Expand 10 before | Expand all | Expand 10 after
4899 DCHECK(!mhtml_boundary.isEmpty()); 4900 DCHECK(!mhtml_boundary.isEmpty());
4900 4901
4901 WebData data; 4902 WebData data;
4902 bool success = true; 4903 bool success = true;
4903 std::set<std::string> digests_of_uris_of_serialized_resources; 4904 std::set<std::string> digests_of_uris_of_serialized_resources;
4904 MHTMLPartsGenerationDelegate delegate( 4905 MHTMLPartsGenerationDelegate delegate(
4905 params, &digests_of_uris_of_serialized_resources); 4906 params, &digests_of_uris_of_serialized_resources);
4906 4907
4907 // Generate MHTML header if needed. 4908 // Generate MHTML header if needed.
4908 if (IsMainFrame()) { 4909 if (IsMainFrame()) {
4909 data = 4910 blink::WebFrameSerializerCacheControlPolicy policy =
4910 WebFrameSerializer::generateMHTMLHeader(mhtml_boundary, GetWebFrame()); 4911 static_cast<blink::WebFrameSerializerCacheControlPolicy>(
4911 if (file.WriteAtCurrentPos(data.data(), data.size()) < 0) { 4912 params.mhtml_cache_control_policy);
4913 success = WebFrameSerializer::generateMHTMLHeader(mhtml_boundary, policy,
4914 GetWebFrame(), &data);
4915 if (success && file.WriteAtCurrentPos(data.data(), data.size()) < 0) {
4912 success = false; 4916 success = false;
4913 } 4917 }
4914 } 4918 }
4915 4919
4916 // Generate MHTML parts. 4920 // Generate MHTML parts.
4917 if (success) { 4921 if (success) {
4918 data = WebFrameSerializer::generateMHTMLParts( 4922 data = WebFrameSerializer::generateMHTMLParts(
4919 mhtml_boundary, GetWebFrame(), params.mhtml_binary_encoding, &delegate); 4923 mhtml_boundary, GetWebFrame(), params.mhtml_binary_encoding, &delegate);
4920 // TODO(jcivelli): write the chunks in deferred tasks to give a chance to 4924 // TODO(jcivelli): write the chunks in deferred tasks to give a chance to
4921 // the message loop to process other events. 4925 // the message loop to process other events.
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
6027 int match_count, 6031 int match_count,
6028 int ordinal, 6032 int ordinal,
6029 const WebRect& selection_rect, 6033 const WebRect& selection_rect,
6030 bool final_status_update) { 6034 bool final_status_update) {
6031 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6035 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6032 selection_rect, ordinal, 6036 selection_rect, ordinal,
6033 final_status_update)); 6037 final_status_update));
6034 } 6038 }
6035 6039
6036 } // namespace content 6040 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698