Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5956)

Unified Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 149239: Split out some of the RVHDelegate functions into separate sub-classes. To lim... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/render_view_host.cc
===================================================================
--- chrome/browser/renderer_host/render_view_host.cc (revision 19988)
+++ chrome/browser/renderer_host/render_view_host.cc (working copy)
@@ -760,8 +760,7 @@
IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
OnUserMetricsRecordAction)
IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus);
- IPC_MESSAGE_FORWARD(ViewHostMsg_CrashedPlugin, delegate_,
- RenderViewHostDelegate::OnCrashedPlugin);
+ IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin);
IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks,
OnReceivedSavableResourceLinksForCurrentPage);
IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData,
@@ -962,7 +961,12 @@
void RenderViewHost::OnMsgDidRedirectProvisionalLoad(int32 page_id,
const GURL& source_url,
const GURL& target_url) {
- delegate_->DidRedirectProvisionalLoad(page_id, source_url, target_url);
+ RenderViewHostDelegate::Resource* resource_delegate =
+ delegate_->GetResourceDelegate();
+ if (resource_delegate) {
+ resource_delegate->DidRedirectProvisionalLoad(page_id,
+ source_url, target_url);
+ }
}
void RenderViewHost::OnMsgDidStartLoading() {
@@ -978,8 +982,12 @@
const std::string& frame_origin,
const std::string& main_frame_origin,
const std::string& security_info) {
- delegate_->DidLoadResourceFromMemoryCache(
- url, frame_origin, main_frame_origin, security_info);
+ RenderViewHostDelegate::Resource* resource_delegate =
+ delegate_->GetResourceDelegate();
+ if (resource_delegate) {
+ resource_delegate->DidLoadResourceFromMemoryCache(
+ url, frame_origin, main_frame_origin, security_info);
+ }
}
void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(bool is_main_frame,
@@ -988,8 +996,12 @@
FilterURL(ChildProcessSecurityPolicy::GetInstance(),
process()->pid(), &validated_url);
- delegate_->DidStartProvisionalLoadForFrame(this, is_main_frame,
- validated_url);
+ RenderViewHostDelegate::Resource* resource_delegate =
+ delegate_->GetResourceDelegate();
+ if (resource_delegate) {
+ resource_delegate->DidStartProvisionalLoadForFrame(this, is_main_frame,
+ validated_url);
+ }
}
void RenderViewHost::OnMsgDidFailProvisionalLoadWithError(
@@ -1001,9 +1013,13 @@
FilterURL(ChildProcessSecurityPolicy::GetInstance(),
process()->pid(), &validated_url);
- delegate_->DidFailProvisionalLoadWithError(this, is_main_frame,
- error_code, validated_url,
- showing_repost_interstitial);
+ RenderViewHostDelegate::Resource* resource_delegate =
+ delegate_->GetResourceDelegate();
+ if (resource_delegate) {
+ resource_delegate->DidFailProvisionalLoadWithError(
+ this, is_main_frame, error_code, validated_url,
+ showing_repost_interstitial);
+ }
}
void RenderViewHost::OnMsgFindReply(int request_id,
@@ -1011,8 +1027,13 @@
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
- delegate_->OnFindReply(request_id, number_of_matches, selection_rect,
- active_match_ordinal, final_update);
+ RenderViewHostDelegate::BrowserIntegration* integration_delegate =
+ delegate_->GetBrowserIntegrationDelegate();
+ if (integration_delegate) {
+ integration_delegate->OnFindReply(request_id, number_of_matches,
+ selection_rect,
+ active_match_ordinal, final_update);
+ }
// Send a notification to the renderer that we are ready to receive more
// results from the scoping effort of the Find operation. The FindInPage
@@ -1025,15 +1046,20 @@
void RenderViewHost::OnMsgUpdateFavIconURL(int32 page_id,
const GURL& icon_url) {
- delegate_->UpdateFavIconURL(this, page_id, icon_url);
+ RenderViewHostDelegate::FavIcon* favicon_delegate =
+ delegate_->GetFavIconDelegate();
+ if (favicon_delegate)
+ favicon_delegate->UpdateFavIconURL(this, page_id, icon_url);
}
-void RenderViewHost::OnMsgDidDownloadImage(
- int id,
- const GURL& image_url,
- bool errored,
- const SkBitmap& image) {
- delegate_->DidDownloadImage(this, id, image_url, errored, image);
+void RenderViewHost::OnMsgDidDownloadImage(int id,
+ const GURL& image_url,
+ bool errored,
+ const SkBitmap& image) {
+ RenderViewHostDelegate::FavIcon* favicon_delegate =
+ delegate_->GetFavIconDelegate();
+ if (favicon_delegate)
+ favicon_delegate->DidDownloadImage(this, id, image_url, errored, image);
Erik does not do reviews 2009/07/07 18:33:05 This method name seems overly generic to me. I kn
}
void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) {
@@ -1045,7 +1071,8 @@
// directly, don't show them in the context menu.
ContextMenuParams validated_params(params);
const int renderer_id = process()->pid();
- ChildProcessSecurityPolicy* policy = ChildProcessSecurityPolicy::GetInstance();
+ ChildProcessSecurityPolicy* policy =
+ ChildProcessSecurityPolicy::GetInstance();
// We don't validate |unfiltered_link_url| so that this field can be used
// when users want to copy the original link URL.
@@ -1109,7 +1136,10 @@
}
void RenderViewHost::OnMsgDocumentLoadedInFrame() {
- delegate_->DocumentLoadedInFrame();
+ RenderViewHostDelegate::Resource* resource_delegate =
+ delegate_->GetResourceDelegate();
+ if (resource_delegate)
+ resource_delegate->DocumentLoadedInFrame();
}
void RenderViewHost::DisassociateFromPopupCount() {
@@ -1121,7 +1151,10 @@
}
void RenderViewHost::OnMsgGoToEntryAtOffset(int offset) {
- delegate_->GoToEntryAtOffset(offset);
+ RenderViewHostDelegate::BrowserIntegration* integration_delegate =
+ delegate_->GetBrowserIntegrationDelegate();
+ if (integration_delegate)
+ integration_delegate->GoToEntryAtOffset(offset);
}
void RenderViewHost::OnMsgSetTooltipText(const std::wstring& tooltip_text) {
@@ -1268,16 +1301,32 @@
}
void RenderViewHost::OnUserGesture() {
- delegate_->OnUserGesture();
+ RenderViewHostDelegate::BrowserIntegration* integration_delegate =
+ delegate_->GetBrowserIntegrationDelegate();
+ if (integration_delegate)
+ integration_delegate->OnUserGesture();
}
void RenderViewHost::OnMissingPluginStatus(int status) {
- delegate_->OnMissingPluginStatus(status);
+ RenderViewHostDelegate::BrowserIntegration* integration_delegate =
+ delegate_->GetBrowserIntegrationDelegate();
+ if (integration_delegate)
+ integration_delegate->OnMissingPluginStatus(status);
}
+void RenderViewHost::OnCrashedPlugin(const FilePath& plugin_path) {
+ RenderViewHostDelegate::BrowserIntegration* integration_delegate =
+ delegate_->GetBrowserIntegrationDelegate();
+ if (integration_delegate)
+ integration_delegate->OnCrashedPlugin(plugin_path);
+}
+
void RenderViewHost::UpdateBackForwardListCount() {
int back_list_count = 0, forward_list_count = 0;
- delegate_->GetHistoryListCount(&back_list_count, &forward_list_count);
+ RenderViewHostDelegate::BrowserIntegration* integration_delegate =
+ delegate_->GetBrowserIntegrationDelegate();
+ if (integration_delegate)
+ integration_delegate->GetHistoryListCount(&back_list_count, &forward_list_count);
Erik does not do reviews 2009/07/07 18:33:05 80 cols
Send(new ViewMsg_UpdateBackForwardListCount(
Erik does not do reviews 2009/07/07 18:33:05 should this message be sent if there isn't a deleg
routing_id(), back_list_count, forward_list_count));
}
@@ -1302,7 +1351,10 @@
void RenderViewHost::OnDidGetApplicationInfo(
int32 page_id,
const webkit_glue::WebApplicationInfo& info) {
- delegate_->OnDidGetApplicationInfo(page_id, info);
+ RenderViewHostDelegate::BrowserIntegration* integration_delegate =
+ delegate_->GetBrowserIntegrationDelegate();
+ if (integration_delegate)
+ integration_delegate->OnDidGetApplicationInfo(page_id, info);
}
void RenderViewHost::GetSerializedHtmlDataForCurrentPageWithLocalLinks(

Powered by Google App Engine
This is Rietveld 408576698