Index: chrome/renderer/render_view.cc |
=================================================================== |
--- chrome/renderer/render_view.cc (revision 71683) |
+++ chrome/renderer/render_view.cc (working copy) |
@@ -1025,6 +1025,8 @@ |
IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences) |
IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) |
IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) |
+ IPC_MESSAGE_HANDLER(ViewMsg_DisplayPrerenderedPage, |
+ OnDisplayPrerenderedPage) |
IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
@@ -1453,8 +1455,14 @@ |
} |
} |
- if (navigation_state) |
- navigation_state->set_load_type(NavigationState::NORMAL_LOAD); |
+ if (navigation_state) { |
+ if (params.navigation_type != ViewMsg_Navigate_Params::PRERENDER) { |
+ navigation_state->set_load_type(NavigationState::NORMAL_LOAD); |
+ } else { |
+ navigation_state->set_load_type(NavigationState::PRERENDER_LOAD); |
+ navigation_state->set_is_prerendering(true); |
+ } |
+ } |
main_frame->loadRequest(request); |
} |
@@ -2709,7 +2717,8 @@ |
params, |
*group, |
IDR_BLOCKED_PLUGIN_HTML, |
- IDS_PLUGIN_OUTDATED); |
+ IDS_PLUGIN_OUTDATED, |
+ false); |
} |
if (!info.enabled) |
@@ -2720,6 +2729,18 @@ |
if (info.path.value() == webkit::npapi::kDefaultPluginLibraryName || |
plugin_setting == CONTENT_SETTING_ALLOW || |
host_setting == CONTENT_SETTING_ALLOW) { |
+ // Delay loading plugins if prerendering. |
+ WebDataSource* ds = frame->dataSource(); |
+ NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
+ if (navigation_state->is_prerendering()) { |
+ return CreatePluginPlaceholder(frame, |
+ params, |
+ *group, |
+ IDR_CLICK_TO_PLAY_PLUGIN_HTML, |
+ IDS_PLUGIN_LOAD, |
+ true); |
+ } |
+ |
scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
pepper_delegate_.CreatePepperPlugin(info.path)); |
if (pepper_module) |
@@ -2735,13 +2756,15 @@ |
params, |
*group, |
IDR_CLICK_TO_PLAY_PLUGIN_HTML, |
- IDS_PLUGIN_LOAD); |
+ IDS_PLUGIN_LOAD, |
+ false); |
} else { |
return CreatePluginPlaceholder(frame, |
params, |
*group, |
IDR_BLOCKED_PLUGIN_HTML, |
- IDS_PLUGIN_BLOCKED); |
+ IDS_PLUGIN_BLOCKED, |
+ false); |
} |
} |
@@ -4376,7 +4399,8 @@ |
const WebPluginParams& params, |
const webkit::npapi::PluginGroup& group, |
int resource_id, |
- int message_id) { |
+ int message_id, |
+ bool is_blocked_for_prerendering) { |
// |blocked_plugin| will delete itself when the WebViewPlugin |
// is destroyed. |
BlockedPlugin* blocked_plugin = |
@@ -4387,7 +4411,8 @@ |
webkit_preferences_, |
resource_id, |
l10n_util::GetStringFUTF16(message_id, |
- group.GetGroupName())); |
+ group.GetGroupName()), |
+ is_blocked_for_prerendering); |
return blocked_plugin->plugin(); |
} |
@@ -4679,6 +4704,17 @@ |
first_default_plugin_->InstallMissingPlugin(); |
} |
+void RenderView::OnDisplayPrerenderedPage() { |
+ NavigationState* navigation_state = pending_navigation_state_.get(); |
+ if (!navigation_state) { |
+ WebDataSource* ds = webview()->mainFrame()->dataSource(); |
+ navigation_state = NavigationState::FromDataSource(ds); |
+ } |
+ |
+ DCHECK(navigation_state->is_prerendering()); |
+ navigation_state->set_is_prerendering(false); |
+} |
+ |
void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) { |
// This could happen if we navigated to a different page before the user |
// closed the chooser. |