| 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/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 if (failed_url.is_valid() && | 1101 if (failed_url.is_valid() && |
| 1102 !failed_url.SchemeIs(extensions::kExtensionScheme)) { | 1102 !failed_url.SchemeIs(extensions::kExtensionScheme)) { |
| 1103 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( | 1103 extension = extension_dispatcher_->extensions()->GetExtensionOrAppByURL( |
| 1104 failed_url); | 1104 failed_url); |
| 1105 } | 1105 } |
| 1106 #endif | 1106 #endif |
| 1107 | 1107 |
| 1108 bool is_post = EqualsASCII(failed_request.httpMethod(), "POST"); | 1108 bool is_post = EqualsASCII(failed_request.httpMethod(), "POST"); |
| 1109 | 1109 |
| 1110 if (error_html) { | 1110 if (error_html) { |
| 1111 bool extension_but_not_bookmark_app = false; |
| 1112 #if defined(ENABLE_EXTENSIONS) |
| 1113 extension_but_not_bookmark_app = extension && !extension->from_bookmark(); |
| 1114 #endif |
| 1111 // Use a local error page. | 1115 // Use a local error page. |
| 1112 if (extension && !extension->from_bookmark()) { | 1116 if (extension_but_not_bookmark_app) { |
| 1117 #if defined(ENABLE_EXTENSIONS) |
| 1113 // TODO(erikkay): Should we use a different template for different | 1118 // TODO(erikkay): Should we use a different template for different |
| 1114 // error messages? | 1119 // error messages? |
| 1115 int resource_id = IDR_ERROR_APP_HTML; | 1120 int resource_id = IDR_ERROR_APP_HTML; |
| 1116 const base::StringPiece template_html( | 1121 const base::StringPiece template_html( |
| 1117 ResourceBundle::GetSharedInstance().GetRawDataResource( | 1122 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 1118 resource_id)); | 1123 resource_id)); |
| 1119 if (template_html.empty()) { | 1124 if (template_html.empty()) { |
| 1120 NOTREACHED() << "unable to load template. ID: " << resource_id; | 1125 NOTREACHED() << "unable to load template. ID: " << resource_id; |
| 1121 } else { | 1126 } else { |
| 1122 base::DictionaryValue error_strings; | 1127 base::DictionaryValue error_strings; |
| 1123 LocalizedError::GetAppErrorStrings(failed_url, extension, | 1128 LocalizedError::GetAppErrorStrings(failed_url, extension, |
| 1124 &error_strings); | 1129 &error_strings); |
| 1125 // "t" is the id of the template's root node. | 1130 // "t" is the id of the template's root node. |
| 1126 *error_html = webui::GetTemplatesHtml(template_html, &error_strings, | 1131 *error_html = webui::GetTemplatesHtml(template_html, &error_strings, |
| 1127 "t"); | 1132 "t"); |
| 1128 } | 1133 } |
| 1134 #endif |
| 1129 } else { | 1135 } else { |
| 1130 // TODO(ellyjones): change GetNavigationErrorStrings to take a RenderFrame | 1136 // TODO(ellyjones): change GetNavigationErrorStrings to take a RenderFrame |
| 1131 // instead of a RenderView, then pass that in. | 1137 // instead of a RenderView, then pass that in. |
| 1132 // This is safe for now because we only install the NetErrorHelper on the | 1138 // This is safe for now because we only install the NetErrorHelper on the |
| 1133 // main render frame anyway; see the TODO(ellyjones) in | 1139 // main render frame anyway; see the TODO(ellyjones) in |
| 1134 // RenderFrameCreated. | 1140 // RenderFrameCreated. |
| 1135 content::RenderFrame* main_render_frame = | 1141 content::RenderFrame* main_render_frame = |
| 1136 render_view->GetMainRenderFrame(); | 1142 render_view->GetMainRenderFrame(); |
| 1137 NetErrorHelper* helper = NetErrorHelper::Get(main_render_frame); | 1143 NetErrorHelper* helper = NetErrorHelper::Get(main_render_frame); |
| 1138 helper->GetErrorHTML(frame, error, is_post, error_html); | 1144 helper->GetErrorHTML(frame, error, is_post, error_html); |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1565 content::BrowserPluginDelegate* | 1571 content::BrowserPluginDelegate* |
| 1566 ChromeContentRendererClient::CreateBrowserPluginDelegate( | 1572 ChromeContentRendererClient::CreateBrowserPluginDelegate( |
| 1567 content::RenderFrame* render_frame, | 1573 content::RenderFrame* render_frame, |
| 1568 const std::string& mime_type) { | 1574 const std::string& mime_type) { |
| 1569 #if defined(ENABLE_EXTENSIONS) | 1575 #if defined(ENABLE_EXTENSIONS) |
| 1570 return new extensions::GuestViewContainer(render_frame, mime_type); | 1576 return new extensions::GuestViewContainer(render_frame, mime_type); |
| 1571 #else | 1577 #else |
| 1572 return NULL; | 1578 return NULL; |
| 1573 #endif | 1579 #endif |
| 1574 } | 1580 } |
| OLD | NEW |