OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "android_webview/renderer/aw_content_renderer_client.h" | 5 #include "android_webview/renderer/aw_content_renderer_client.h" |
6 | 6 |
7 #include "android_webview/common/aw_resource.h" | 7 #include "android_webview/common/aw_resource.h" |
8 #include "android_webview/common/url_constants.h" | 8 #include "android_webview/common/url_constants.h" |
9 #include "android_webview/renderer/aw_render_view_ext.h" | 9 #include "android_webview/renderer/aw_render_view_ext.h" |
10 #include "android_webview/renderer/view_renderer.h" | 10 #include "android_webview/renderer/view_renderer.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 std::string* error_domain) { | 56 std::string* error_domain) { |
57 return http_status_code >= 400; | 57 return http_status_code >= 400; |
58 } | 58 } |
59 | 59 |
60 void AwContentRendererClient::GetNavigationErrorStrings( | 60 void AwContentRendererClient::GetNavigationErrorStrings( |
61 WebKit::WebFrame* /* frame */, | 61 WebKit::WebFrame* /* frame */, |
62 const WebKit::WebURLRequest& failed_request, | 62 const WebKit::WebURLRequest& failed_request, |
63 const WebKit::WebURLError& error, | 63 const WebKit::WebURLError& error, |
64 std::string* error_html, | 64 std::string* error_html, |
65 string16* error_description) { | 65 string16* error_description) { |
66 std::string err = UTF16ToUTF8(error.localizedDescription); | |
benm (inactive)
2013/06/05 09:35:08
I think you could leave this inside the error_html
mnaganov (inactive)
2013/06/05 09:46:21
Sorry, I've made this change in a very mechanical
| |
66 if (error_html) { | 67 if (error_html) { |
67 GURL error_url(failed_request.url()); | 68 GURL error_url(failed_request.url()); |
68 std::string err = UTF16ToUTF8(error.localizedDescription); | |
69 std::string contents; | 69 std::string contents; |
70 if (err.empty()) { | 70 if (err.empty()) { |
71 contents = AwResource::GetNoDomainPageContent(); | 71 contents = AwResource::GetNoDomainPageContent(); |
72 if (error_description) | |
73 *error_description = ASCIIToUTF16(net::ErrorToString(error.reason)); | |
74 } else { | 72 } else { |
75 contents = AwResource::GetLoadErrorPageContent(); | 73 contents = AwResource::GetLoadErrorPageContent(); |
76 ReplaceSubstringsAfterOffset(&contents, 0, "%e", err); | 74 ReplaceSubstringsAfterOffset(&contents, 0, "%e", err); |
77 if (error_description) | |
78 *error_description = error.localizedDescription; | |
79 } | 75 } |
80 | 76 |
81 ReplaceSubstringsAfterOffset(&contents, 0, "%s", | 77 ReplaceSubstringsAfterOffset(&contents, 0, "%s", |
82 error_url.possibly_invalid_spec()); | 78 error_url.possibly_invalid_spec()); |
83 *error_html = contents; | 79 *error_html = contents; |
84 } | 80 } |
81 if (error_description) { | |
82 if (err.empty()) | |
83 *error_description = ASCIIToUTF16(net::ErrorToString(error.reason)); | |
84 else | |
85 *error_description = error.localizedDescription; | |
86 } | |
85 } | 87 } |
86 | 88 |
87 unsigned long long AwContentRendererClient::VisitedLinkHash( | 89 unsigned long long AwContentRendererClient::VisitedLinkHash( |
88 const char* canonical_url, | 90 const char* canonical_url, |
89 size_t length) { | 91 size_t length) { |
90 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length); | 92 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length); |
91 } | 93 } |
92 | 94 |
93 bool AwContentRendererClient::IsLinkVisited(unsigned long long link_hash) { | 95 bool AwContentRendererClient::IsLinkVisited(unsigned long long link_hash) { |
94 return visited_link_slave_->IsVisited(link_hash); | 96 return visited_link_slave_->IsVisited(link_hash); |
95 } | 97 } |
96 | 98 |
97 void AwContentRendererClient::PrefetchHostName(const char* hostname, | 99 void AwContentRendererClient::PrefetchHostName(const char* hostname, |
98 size_t length) { | 100 size_t length) { |
99 // TODO(boliu): Implement hostname prefetch for Android WebView. | 101 // TODO(boliu): Implement hostname prefetch for Android WebView. |
100 // Perhaps componentize chrome implementation or move to content/? | 102 // Perhaps componentize chrome implementation or move to content/? |
101 } | 103 } |
102 | 104 |
103 } // namespace android_webview | 105 } // namespace android_webview |
OLD | NEW |