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

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: Rebase onto origin/master. 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
« no previous file with comments | « content/public/common/mhtml_generation_params.cc ('k') | content/test/data/nostore.html » ('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 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_params.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 4868 matching lines...) Expand 10 before | Expand all | Expand 10 after
4950 DCHECK(!mhtml_boundary.isEmpty()); 4951 DCHECK(!mhtml_boundary.isEmpty());
4951 4952
4952 WebData data; 4953 WebData data;
4953 bool success = true; 4954 bool success = true;
4954 std::set<std::string> digests_of_uris_of_serialized_resources; 4955 std::set<std::string> digests_of_uris_of_serialized_resources;
4955 MHTMLPartsGenerationDelegate delegate( 4956 MHTMLPartsGenerationDelegate delegate(
4956 params, &digests_of_uris_of_serialized_resources); 4957 params, &digests_of_uris_of_serialized_resources);
4957 4958
4958 // Generate MHTML header if needed. 4959 // Generate MHTML header if needed.
4959 if (IsMainFrame()) { 4960 if (IsMainFrame()) {
4960 data = 4961 blink::WebFrameSerializerCacheControlPolicy policy =
4961 WebFrameSerializer::generateMHTMLHeader(mhtml_boundary, GetWebFrame()); 4962 static_cast<blink::WebFrameSerializerCacheControlPolicy>(
4962 if (file.WriteAtCurrentPos(data.data(), data.size()) < 0) { 4963 params.mhtml_cache_control_policy);
4964 success = WebFrameSerializer::generateMHTMLHeader(mhtml_boundary, policy,
4965 GetWebFrame(), &data);
4966 if (success && file.WriteAtCurrentPos(data.data(), data.size()) < 0) {
4963 success = false; 4967 success = false;
4964 } 4968 }
4965 } 4969 }
4966 4970
4967 // Generate MHTML parts. 4971 // Generate MHTML parts.
4968 if (success) { 4972 if (success) {
4969 data = WebFrameSerializer::generateMHTMLParts( 4973 data = WebFrameSerializer::generateMHTMLParts(
4970 mhtml_boundary, GetWebFrame(), params.mhtml_binary_encoding, &delegate); 4974 mhtml_boundary, GetWebFrame(), params.mhtml_binary_encoding, &delegate);
4971 // TODO(jcivelli): write the chunks in deferred tasks to give a chance to 4975 // TODO(jcivelli): write the chunks in deferred tasks to give a chance to
4972 // the message loop to process other events. 4976 // the message loop to process other events.
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
6136 // event target. Potentially a Pepper plugin will receive the event. 6140 // event target. Potentially a Pepper plugin will receive the event.
6137 // In order to tell whether a plugin gets the last mouse event and which it 6141 // In order to tell whether a plugin gets the last mouse event and which it
6138 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6142 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6139 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6143 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6140 // |pepper_last_mouse_event_target_|. 6144 // |pepper_last_mouse_event_target_|.
6141 pepper_last_mouse_event_target_ = nullptr; 6145 pepper_last_mouse_event_target_ = nullptr;
6142 #endif 6146 #endif
6143 } 6147 }
6144 6148
6145 } // namespace content 6149 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/mhtml_generation_params.cc ('k') | content/test/data/nostore.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698