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

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
« no previous file with comments | « content/public/renderer/content_renderer_client.cc ('k') | content/test/BUILD.gn » ('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 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 4370 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 InternalDocumentStateData* internal_data = 4455 InternalDocumentStateData* internal_data =
4455 InternalDocumentStateData::FromDocumentState(document_state); 4456 InternalDocumentStateData::FromDocumentState(document_state);
4456 NavigationStateImpl* navigation_state = 4457 NavigationStateImpl* navigation_state =
4457 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 4458 static_cast<NavigationStateImpl*>(document_state->navigation_state());
4458 ui::PageTransition transition_type = navigation_state->GetTransitionType(); 4459 ui::PageTransition transition_type = navigation_state->GetTransitionType();
4459 if (provisional_data_source && provisional_data_source->IsClientRedirect()) { 4460 if (provisional_data_source && provisional_data_source->IsClientRedirect()) {
4460 transition_type = ui::PageTransitionFromInt( 4461 transition_type = ui::PageTransitionFromInt(
4461 transition_type | ui::PAGE_TRANSITION_CLIENT_REDIRECT); 4462 transition_type | ui::PAGE_TRANSITION_CLIENT_REDIRECT);
4462 } 4463 }
4463 4464
4465 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles;
4464 GURL new_url; 4466 GURL new_url;
4465 if (GetContentClient()->renderer()->WillSendRequest( 4467 if (GetContentClient()->renderer()->WillSendRequest(
4466 frame_, transition_type, request.Url(), &new_url)) { 4468 frame_, transition_type, request.Url(), &throttles, &new_url)) {
4467 request.SetURL(WebURL(new_url)); 4469 request.SetURL(WebURL(new_url));
4468 } 4470 }
4469 4471
4470 if (internal_data->is_cache_policy_override_set()) 4472 if (internal_data->is_cache_policy_override_set())
4471 request.SetCachePolicy(internal_data->cache_policy_override()); 4473 request.SetCachePolicy(internal_data->cache_policy_override());
4472 4474
4473 // The request's extra data may indicate that we should set a custom user 4475 // The request's extra data may indicate that we should set a custom user
4474 // agent. This needs to be done here, after WebKit is through with setting the 4476 // agent. This needs to be done here, after WebKit is through with setting the
4475 // user agent on its own. Similarly, it may indicate that we should set an 4477 // user agent on its own. Similarly, it may indicate that we should set an
4476 // X-Requested-With header. This must be done here to avoid breaking CORS 4478 // X-Requested-With header. This must be done here to avoid breaking CORS
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 // instance. 4555 // instance.
4554 RequestExtraData* current_request_data = 4556 RequestExtraData* current_request_data =
4555 static_cast<RequestExtraData*>(request.GetExtraData()); 4557 static_cast<RequestExtraData*>(request.GetExtraData());
4556 if (current_request_data) { 4558 if (current_request_data) {
4557 extra_data->set_navigation_initiated_by_renderer( 4559 extra_data->set_navigation_initiated_by_renderer(
4558 current_request_data->navigation_initiated_by_renderer()); 4560 current_request_data->navigation_initiated_by_renderer());
4559 } 4561 }
4560 } 4562 }
4561 4563
4562 extra_data->set_url_loader_factory_override(url_loader_factory_.get()); 4564 extra_data->set_url_loader_factory_override(url_loader_factory_.get());
4565 // TODO(kinuko, yzshen): We need to set up throttles for some worker cases
4566 // that don't go through here.
4567 extra_data->set_url_loader_throttles(std::move(throttles));
4563 4568
4564 request.SetExtraData(extra_data); 4569 request.SetExtraData(extra_data);
4565 4570
4566 if (request.GetPreviewsState() == WebURLRequest::kPreviewsUnspecified) { 4571 if (request.GetPreviewsState() == WebURLRequest::kPreviewsUnspecified) {
4567 if (is_main_frame_ && !navigation_state->request_committed()) { 4572 if (is_main_frame_ && !navigation_state->request_committed()) {
4568 request.SetPreviewsState(static_cast<WebURLRequest::PreviewsState>( 4573 request.SetPreviewsState(static_cast<WebURLRequest::PreviewsState>(
4569 navigation_state->common_params().previews_state)); 4574 navigation_state->common_params().previews_state));
4570 } else { 4575 } else {
4571 WebURLRequest::PreviewsState request_previews_state = 4576 WebURLRequest::PreviewsState request_previews_state =
4572 static_cast<WebURLRequest::PreviewsState>(previews_state_); 4577 static_cast<WebURLRequest::PreviewsState>(previews_state_);
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after
7173 policy(info.default_policy), 7178 policy(info.default_policy),
7174 replaces_current_history_item(info.replaces_current_history_item), 7179 replaces_current_history_item(info.replaces_current_history_item),
7175 history_navigation_in_new_child_frame( 7180 history_navigation_in_new_child_frame(
7176 info.is_history_navigation_in_new_child_frame), 7181 info.is_history_navigation_in_new_child_frame),
7177 client_redirect(info.is_client_redirect), 7182 client_redirect(info.is_client_redirect),
7178 cache_disabled(info.is_cache_disabled), 7183 cache_disabled(info.is_cache_disabled),
7179 form(info.form), 7184 form(info.form),
7180 source_location(info.source_location) {} 7185 source_location(info.source_location) {}
7181 7186
7182 } // namespace content 7187 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/content_renderer_client.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698