OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, | 828 if (!LocalizedError::HasStrings(LocalizedError::kHttpErrorDomain, |
829 http_status_code)) { | 829 http_status_code)) { |
830 return false; | 830 return false; |
831 } | 831 } |
832 | 832 |
833 *error_domain = LocalizedError::kHttpErrorDomain; | 833 *error_domain = LocalizedError::kHttpErrorDomain; |
834 return true; | 834 return true; |
835 } | 835 } |
836 | 836 |
837 void ChromeContentRendererClient::GetNavigationErrorStrings( | 837 void ChromeContentRendererClient::GetNavigationErrorStrings( |
838 WebKit::WebFrame* /* frame */, | 838 WebKit::WebFrame* frame, |
839 const WebKit::WebURLRequest& failed_request, | 839 const WebKit::WebURLRequest& failed_request, |
840 const WebKit::WebURLError& error, | 840 const WebKit::WebURLError& error, |
841 std::string* error_html, | 841 std::string* error_html, |
842 string16* error_description) { | 842 string16* error_description) { |
843 const GURL failed_url = error.unreachableURL; | 843 const GURL failed_url = error.unreachableURL; |
844 const Extension* extension = NULL; | 844 const Extension* extension = NULL; |
845 | 845 |
846 if (failed_url.is_valid() && | 846 if (failed_url.is_valid() && |
847 !failed_url.SchemeIs(extensions::kExtensionScheme)) { | 847 !failed_url.SchemeIs(extensions::kExtensionScheme)) { |
848 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( | 848 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( |
849 ExtensionURLInfo(failed_url)); | 849 ExtensionURLInfo(failed_url)); |
850 } | 850 } |
851 | 851 |
852 bool is_post = EqualsASCII(failed_request.httpMethod(), "POST"); | 852 bool is_post = EqualsASCII(failed_request.httpMethod(), "POST"); |
853 | 853 |
854 if (error_html) { | 854 if (error_html) { |
855 // Use a local error page. | 855 // Use a local error page. |
856 int resource_id; | 856 int resource_id; |
857 DictionaryValue error_strings; | 857 DictionaryValue error_strings; |
858 if (extension && !extension->from_bookmark()) { | 858 if (extension && !extension->from_bookmark()) { |
859 LocalizedError::GetAppErrorStrings(error, failed_url, extension, | 859 LocalizedError::GetAppErrorStrings(error, failed_url, extension, |
860 &error_strings); | 860 &error_strings); |
861 | 861 |
862 // TODO(erikkay): Should we use a different template for different | 862 // TODO(erikkay): Should we use a different template for different |
863 // error messages? | 863 // error messages? |
864 resource_id = IDR_ERROR_APP_HTML; | 864 resource_id = IDR_ERROR_APP_HTML; |
865 } else { | 865 } else { |
866 LocalizedError::GetStrings( | 866 const std::string locale = RenderThread::Get()->GetLocale(); |
867 error, | 867 if (NetErrorHelper::GetErrorStringsForDnsProbe( |
868 is_post, | 868 frame, error, is_post, locale, &error_strings)) { |
mmenke
2013/06/13 20:04:55
Don't really need an else/if here, and I don't thi
Deprecated (see juliatuttle)
2013/06/18 19:36:37
Done.
| |
869 RenderThread::Get()->GetLocale(), | 869 // We got error strings for the "DNS probe possible" page. |
870 &error_strings); | 870 // NetErrorHelper will update it later. |
mmenke
2013/06/13 20:04:55
nit: Also, if you keep a comment here, get rid of
Deprecated (see juliatuttle)
2013/06/18 19:36:37
Obsolete.
| |
871 } else { | |
872 LocalizedError::GetStrings(error, is_post, locale, &error_strings); | |
873 } | |
871 resource_id = IDR_NET_ERROR_HTML; | 874 resource_id = IDR_NET_ERROR_HTML; |
872 } | 875 } |
873 | 876 |
874 const base::StringPiece template_html( | 877 const base::StringPiece template_html( |
875 ResourceBundle::GetSharedInstance().GetRawDataResource( | 878 ResourceBundle::GetSharedInstance().GetRawDataResource( |
876 resource_id)); | 879 resource_id)); |
877 if (template_html.empty()) { | 880 if (template_html.empty()) { |
878 NOTREACHED() << "unable to load template. ID: " << resource_id; | 881 NOTREACHED() << "unable to load template. ID: " << resource_id; |
879 } else { | 882 } else { |
880 // "t" is the id of the templates root node. | 883 // "t" is the id of the templates root node. |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 | 1228 |
1226 if (container->element().shadowHost().isNull()) | 1229 if (container->element().shadowHost().isNull()) |
1227 return false; | 1230 return false; |
1228 | 1231 |
1229 WebString tag_name = container->element().shadowHost().tagName(); | 1232 WebString tag_name = container->element().shadowHost().tagName(); |
1230 return tag_name.equals(WebString::fromUTF8(kWebViewTagName)) || | 1233 return tag_name.equals(WebString::fromUTF8(kWebViewTagName)) || |
1231 tag_name.equals(WebString::fromUTF8(kAdViewTagName)); | 1234 tag_name.equals(WebString::fromUTF8(kAdViewTagName)); |
1232 } | 1235 } |
1233 | 1236 |
1234 } // namespace chrome | 1237 } // namespace chrome |
OLD | NEW |