| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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) |
| OLD | NEW |