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

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

Issue 2900563002: Network service: Safe browsing check for sub-resources from renderer. (Closed)
Patch Set: . Created 3 years, 6 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "content/common/frame_replication_state.h" 64 #include "content/common/frame_replication_state.h"
65 #include "content/common/input_messages.h" 65 #include "content/common/input_messages.h"
66 #include "content/common/navigation_params.h" 66 #include "content/common/navigation_params.h"
67 #include "content/common/page_messages.h" 67 #include "content/common/page_messages.h"
68 #include "content/common/savable_subframe.h" 68 #include "content/common/savable_subframe.h"
69 #include "content/common/service_worker/service_worker_types.h" 69 #include "content/common/service_worker/service_worker_types.h"
70 #include "content/common/site_isolation_policy.h" 70 #include "content/common/site_isolation_policy.h"
71 #include "content/common/swapped_out_messages.h" 71 #include "content/common/swapped_out_messages.h"
72 #include "content/common/view_messages.h" 72 #include "content/common/view_messages.h"
73 #include "content/common/worker_url_loader_factory_provider.mojom.h" 73 #include "content/common/worker_url_loader_factory_provider.mojom.h"
74 #include "content/public/child/url_loader_throttle.h"
74 #include "content/public/common/appcache_info.h" 75 #include "content/public/common/appcache_info.h"
75 #include "content/public/common/associated_interface_provider.h" 76 #include "content/public/common/associated_interface_provider.h"
76 #include "content/public/common/bindings_policy.h" 77 #include "content/public/common/bindings_policy.h"
77 #include "content/public/common/browser_side_navigation_policy.h" 78 #include "content/public/common/browser_side_navigation_policy.h"
78 #include "content/public/common/content_constants.h" 79 #include "content/public/common/content_constants.h"
79 #include "content/public/common/content_features.h" 80 #include "content/public/common/content_features.h"
80 #include "content/public/common/content_switches.h" 81 #include "content/public/common/content_switches.h"
81 #include "content/public/common/context_menu_params.h" 82 #include "content/public/common/context_menu_params.h"
82 #include "content/public/common/file_chooser_file_info.h" 83 #include "content/public/common/file_chooser_file_info.h"
83 #include "content/public/common/file_chooser_params.h" 84 #include "content/public/common/file_chooser_params.h"
(...skipping 4274 matching lines...) Expand 10 before | Expand all | Expand 10 after
4358 InternalDocumentStateData::FromDocumentState(document_state); 4359 InternalDocumentStateData::FromDocumentState(document_state);
4359 NavigationStateImpl* navigation_state = 4360 NavigationStateImpl* navigation_state =
4360 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 4361 static_cast<NavigationStateImpl*>(document_state->navigation_state());
4361 ui::PageTransition transition_type = navigation_state->GetTransitionType(); 4362 ui::PageTransition transition_type = navigation_state->GetTransitionType();
4362 if (provisional_data_source && provisional_data_source->IsClientRedirect()) { 4363 if (provisional_data_source && provisional_data_source->IsClientRedirect()) {
4363 transition_type = ui::PageTransitionFromInt( 4364 transition_type = ui::PageTransitionFromInt(
4364 transition_type | ui::PAGE_TRANSITION_CLIENT_REDIRECT); 4365 transition_type | ui::PAGE_TRANSITION_CLIENT_REDIRECT);
4365 } 4366 }
4366 4367
4367 GURL new_url; 4368 GURL new_url;
4369 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles;
4368 if (GetContentClient()->renderer()->WillSendRequest( 4370 if (GetContentClient()->renderer()->WillSendRequest(
4369 frame_, transition_type, request.Url(), &new_url)) { 4371 frame_, transition_type, request.Url(), &new_url, &throttles)) {
4370 request.SetURL(WebURL(new_url)); 4372 request.SetURL(WebURL(new_url));
4371 } 4373 }
4372 4374
4373 if (internal_data->is_cache_policy_override_set()) 4375 if (internal_data->is_cache_policy_override_set())
4374 request.SetCachePolicy(internal_data->cache_policy_override()); 4376 request.SetCachePolicy(internal_data->cache_policy_override());
4375 4377
4376 // The request's extra data may indicate that we should set a custom user 4378 // The request's extra data may indicate that we should set a custom user
4377 // agent. This needs to be done here, after WebKit is through with setting the 4379 // agent. This needs to be done here, after WebKit is through with setting the
4378 // user agent on its own. Similarly, it may indicate that we should set an 4380 // user agent on its own. Similarly, it may indicate that we should set an
4379 // X-Requested-With header. This must be done here to avoid breaking CORS 4381 // X-Requested-With header. This must be done here to avoid breaking CORS
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
4455 // instance. 4457 // instance.
4456 RequestExtraData* current_request_data = 4458 RequestExtraData* current_request_data =
4457 static_cast<RequestExtraData*>(request.GetExtraData()); 4459 static_cast<RequestExtraData*>(request.GetExtraData());
4458 if (current_request_data) { 4460 if (current_request_data) {
4459 extra_data->set_navigation_initiated_by_renderer( 4461 extra_data->set_navigation_initiated_by_renderer(
4460 current_request_data->navigation_initiated_by_renderer()); 4462 current_request_data->navigation_initiated_by_renderer());
4461 } 4463 }
4462 } 4464 }
4463 4465
4464 extra_data->set_url_loader_factory_override(url_loader_factory_.get()); 4466 extra_data->set_url_loader_factory_override(url_loader_factory_.get());
4467 extra_data->set_url_loader_throttles(std::move(throttles));
kinuko 2017/05/29 13:36:50 Can you add a todo comment to note that we need to
yzshen1 2017/05/31 00:30:06 Done.
4465 4468
4466 request.SetExtraData(extra_data); 4469 request.SetExtraData(extra_data);
4467 4470
4468 if (request.GetPreviewsState() == WebURLRequest::kPreviewsUnspecified) { 4471 if (request.GetPreviewsState() == WebURLRequest::kPreviewsUnspecified) {
4469 if (is_main_frame_ && !navigation_state->request_committed()) { 4472 if (is_main_frame_ && !navigation_state->request_committed()) {
4470 request.SetPreviewsState(static_cast<WebURLRequest::PreviewsState>( 4473 request.SetPreviewsState(static_cast<WebURLRequest::PreviewsState>(
4471 navigation_state->common_params().previews_state)); 4474 navigation_state->common_params().previews_state));
4472 } else { 4475 } else {
4473 WebURLRequest::PreviewsState request_previews_state = 4476 WebURLRequest::PreviewsState request_previews_state =
4474 static_cast<WebURLRequest::PreviewsState>(previews_state_); 4477 static_cast<WebURLRequest::PreviewsState>(previews_state_);
(...skipping 2588 matching lines...) Expand 10 before | Expand all | Expand 10 after
7063 policy(info.default_policy), 7066 policy(info.default_policy),
7064 replaces_current_history_item(info.replaces_current_history_item), 7067 replaces_current_history_item(info.replaces_current_history_item),
7065 history_navigation_in_new_child_frame( 7068 history_navigation_in_new_child_frame(
7066 info.is_history_navigation_in_new_child_frame), 7069 info.is_history_navigation_in_new_child_frame),
7067 client_redirect(info.is_client_redirect), 7070 client_redirect(info.is_client_redirect),
7068 cache_disabled(info.is_cache_disabled), 7071 cache_disabled(info.is_cache_disabled),
7069 form(info.form), 7072 form(info.form),
7070 source_location(info.source_location) {} 7073 source_location(info.source_location) {}
7071 7074
7072 } // namespace content 7075 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698