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

Side by Side Diff: chrome/renderer/net/net_error_helper.cc

Issue 2125263002: Explicitly set a requestor origin when calling into WebLocalFrame::loadRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: blink:: Created 4 years, 5 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 | « no previous file | components/printing/renderer/print_web_view_helper.cc » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/renderer/net/net_error_helper.h" 5 #include "chrome/renderer/net/net_error_helper.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
25 #include "content/public/renderer/content_renderer_client.h" 25 #include "content/public/renderer/content_renderer_client.h"
26 #include "content/public/renderer/document_state.h" 26 #include "content/public/renderer/document_state.h"
27 #include "content/public/renderer/render_frame.h" 27 #include "content/public/renderer/render_frame.h"
28 #include "content/public/renderer/render_thread.h" 28 #include "content/public/renderer/render_thread.h"
29 #include "content/public/renderer/render_view.h" 29 #include "content/public/renderer/render_view.h"
30 #include "content/public/renderer/resource_fetcher.h" 30 #include "content/public/renderer/resource_fetcher.h"
31 #include "grit/components_resources.h" 31 #include "grit/components_resources.h"
32 #include "ipc/ipc_message.h" 32 #include "ipc/ipc_message.h"
33 #include "ipc/ipc_message_macros.h" 33 #include "ipc/ipc_message_macros.h"
34 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
34 #include "third_party/WebKit/public/platform/WebURL.h" 35 #include "third_party/WebKit/public/platform/WebURL.h"
35 #include "third_party/WebKit/public/platform/WebURLError.h" 36 #include "third_party/WebKit/public/platform/WebURLError.h"
36 #include "third_party/WebKit/public/platform/WebURLRequest.h" 37 #include "third_party/WebKit/public/platform/WebURLRequest.h"
37 #include "third_party/WebKit/public/platform/WebURLResponse.h" 38 #include "third_party/WebKit/public/platform/WebURLResponse.h"
38 #include "third_party/WebKit/public/web/WebDataSource.h" 39 #include "third_party/WebKit/public/web/WebDataSource.h"
39 #include "third_party/WebKit/public/web/WebDocument.h" 40 #include "third_party/WebKit/public/web/WebDocument.h"
40 #include "third_party/WebKit/public/web/WebFrame.h" 41 #include "third_party/WebKit/public/web/WebFrame.h"
41 #include "third_party/WebKit/public/web/WebLocalFrame.h" 42 #include "third_party/WebKit/public/web/WebLocalFrame.h"
42 #include "ui/base/resource/resource_bundle.h" 43 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/base/webui/jstemplate_builder.h" 44 #include "ui/base/webui/jstemplate_builder.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 309 }
309 310
310 void NetErrorHelper::LoadPageFromCache(const GURL& page_url) { 311 void NetErrorHelper::LoadPageFromCache(const GURL& page_url) {
311 blink::WebFrame* web_frame = render_frame()->GetWebFrame(); 312 blink::WebFrame* web_frame = render_frame()->GetWebFrame();
312 DCHECK(!base::EqualsASCII( 313 DCHECK(!base::EqualsASCII(
313 base::StringPiece16(web_frame->dataSource()->request().httpMethod()), 314 base::StringPiece16(web_frame->dataSource()->request().httpMethod()),
314 "POST")); 315 "POST"));
315 316
316 blink::WebURLRequest request(page_url); 317 blink::WebURLRequest request(page_url);
317 request.setCachePolicy(blink::WebCachePolicy::ReturnCacheDataDontLoad); 318 request.setCachePolicy(blink::WebCachePolicy::ReturnCacheDataDontLoad);
318 319 request.setRequestorOrigin(blink::WebSecurityOrigin::createUnique());
319 web_frame->loadRequest(request); 320 web_frame->loadRequest(request);
320 } 321 }
321 322
322 void NetErrorHelper::DiagnoseError(const GURL& page_url) { 323 void NetErrorHelper::DiagnoseError(const GURL& page_url) {
323 render_frame()->Send(new ChromeViewHostMsg_RunNetworkDiagnostics( 324 render_frame()->Send(new ChromeViewHostMsg_RunNetworkDiagnostics(
324 render_frame()->GetRoutingID(), page_url)); 325 render_frame()->GetRoutingID(), page_url));
325 } 326 }
326 327
327 void NetErrorHelper::ShowOfflinePages() { 328 void NetErrorHelper::ShowOfflinePages() {
328 #if defined(OS_ANDROID) 329 #if defined(OS_ANDROID)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 const blink::WebURLResponse& response, 372 const blink::WebURLResponse& response,
372 const std::string& data) { 373 const std::string& data) {
373 tracking_fetcher_.reset(); 374 tracking_fetcher_.reset();
374 } 375 }
375 376
376 #if defined(OS_ANDROID) 377 #if defined(OS_ANDROID)
377 void NetErrorHelper::OnSetHasOfflinePages(bool has_offline_pages) { 378 void NetErrorHelper::OnSetHasOfflinePages(bool has_offline_pages) {
378 core_->OnSetHasOfflinePages(has_offline_pages); 379 core_->OnSetHasOfflinePages(has_offline_pages);
379 } 380 }
380 #endif // defined(OS_ANDROID) 381 #endif // defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « no previous file | components/printing/renderer/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698