OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback_old.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/json/json_value_serializer.h" | 16 #include "base/json/json_value_serializer.h" |
16 #include "base/json/json_writer.h" | 17 #include "base/json/json_writer.h" |
17 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
20 #include "base/process_util.h" | 21 #include "base/process_util.h" |
21 #include "base/string_piece.h" | 22 #include "base/string_piece.h" |
22 #include "base/string_split.h" | 23 #include "base/string_split.h" |
(...skipping 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2752 GetAlternateErrorPageURL(document_url, HTTP_404); | 2753 GetAlternateErrorPageURL(document_url, HTTP_404); |
2753 if (error_page_url.is_valid()) { | 2754 if (error_page_url.is_valid()) { |
2754 WebURLError original_error; | 2755 WebURLError original_error; |
2755 original_error.domain = "http"; | 2756 original_error.domain = "http"; |
2756 original_error.reason = 404; | 2757 original_error.reason = 404; |
2757 original_error.unreachableURL = document_url; | 2758 original_error.unreachableURL = document_url; |
2758 | 2759 |
2759 document_state->set_alt_error_page_fetcher( | 2760 document_state->set_alt_error_page_fetcher( |
2760 new AltErrorPageResourceFetcher( | 2761 new AltErrorPageResourceFetcher( |
2761 error_page_url, frame, original_error, | 2762 error_page_url, frame, original_error, |
2762 NewCallback(this, &RenderViewImpl::AltErrorPageFinished))); | 2763 base::Bind(&RenderViewImpl::AltErrorPageFinished, |
| 2764 base::Unretained(this)))); |
2763 return; | 2765 return; |
2764 } | 2766 } |
2765 } | 2767 } |
2766 | 2768 |
2767 std::string error_domain; | 2769 std::string error_domain; |
2768 if (content::GetContentClient()->renderer()->HasErrorPage( | 2770 if (content::GetContentClient()->renderer()->HasErrorPage( |
2769 http_status_code, &error_domain)) { | 2771 http_status_code, &error_domain)) { |
2770 WebURLError error; | 2772 WebURLError error; |
2771 error.unreachableURL = frame->document().url(); | 2773 error.unreachableURL = frame->document().url(); |
2772 error.domain = WebString::fromUTF8(error_domain); | 2774 error.domain = WebString::fromUTF8(error_domain); |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4013 replace); | 4015 replace); |
4014 | 4016 |
4015 // Now, create a fetcher for the error page and associate it with the data | 4017 // Now, create a fetcher for the error page and associate it with the data |
4016 // source we just created via the LoadHTMLString call. That way if another | 4018 // source we just created via the LoadHTMLString call. That way if another |
4017 // navigation occurs, the fetcher will get destroyed. | 4019 // navigation occurs, the fetcher will get destroyed. |
4018 DocumentState* document_state = | 4020 DocumentState* document_state = |
4019 DocumentState::FromDataSource(frame->provisionalDataSource()); | 4021 DocumentState::FromDataSource(frame->provisionalDataSource()); |
4020 document_state->set_alt_error_page_fetcher( | 4022 document_state->set_alt_error_page_fetcher( |
4021 new AltErrorPageResourceFetcher( | 4023 new AltErrorPageResourceFetcher( |
4022 error_page_url, frame, error, | 4024 error_page_url, frame, error, |
4023 NewCallback(this, &RenderViewImpl::AltErrorPageFinished))); | 4025 base::Bind(&RenderViewImpl::AltErrorPageFinished, |
| 4026 base::Unretained(this)))); |
4024 return true; | 4027 return true; |
4025 } | 4028 } |
4026 | 4029 |
4027 void RenderViewImpl::AltErrorPageFinished(WebFrame* frame, | 4030 void RenderViewImpl::AltErrorPageFinished(WebFrame* frame, |
4028 const WebURLError& original_error, | 4031 const WebURLError& original_error, |
4029 const std::string& html) { | 4032 const std::string& html) { |
4030 // Here, we replace the blank page we loaded previously. | 4033 // Here, we replace the blank page we loaded previously. |
4031 // If we failed to download the alternate error page, LoadNavigationErrorPage | 4034 // If we failed to download the alternate error page, LoadNavigationErrorPage |
4032 // will simply display a default error page. | 4035 // will simply display a default error page. |
4033 LoadNavigationErrorPage(frame, WebURLRequest(), original_error, html, true); | 4036 LoadNavigationErrorPage(frame, WebURLRequest(), original_error, html, true); |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4725 return !!RenderThreadImpl::current()->compositor_thread(); | 4728 return !!RenderThreadImpl::current()->compositor_thread(); |
4726 } | 4729 } |
4727 | 4730 |
4728 void RenderViewImpl::OnJavaBridgeInit( | 4731 void RenderViewImpl::OnJavaBridgeInit( |
4729 const IPC::ChannelHandle& channel_handle) { | 4732 const IPC::ChannelHandle& channel_handle) { |
4730 DCHECK(!java_bridge_dispatcher_.get()); | 4733 DCHECK(!java_bridge_dispatcher_.get()); |
4731 #if defined(ENABLE_JAVA_BRIDGE) | 4734 #if defined(ENABLE_JAVA_BRIDGE) |
4732 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4735 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4733 #endif | 4736 #endif |
4734 } | 4737 } |
OLD | NEW |