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