diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-28 02:09:33 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-28 02:09:33 +0000 |
commit | 53a0afa4218c19221e2df65b664a7d42f72fc2e0 (patch) | |
tree | 5655172bbc9f1d756c5d2c2cf65119679255715c /content | |
parent | f4d5e1ae2530667dc52bcce555e70e47bdc37371 (diff) | |
download | chromium_src-53a0afa4218c19221e2df65b664a7d42f72fc2e0.zip chromium_src-53a0afa4218c19221e2df65b664a7d42f72fc2e0.tar.gz chromium_src-53a0afa4218c19221e2df65b664a7d42f72fc2e0.tar.bz2 |
Move a few Chrome messages out of RenderViewHost. I added ChromeRenderViewHostObserver, to be the browser equivalent of the renderer's ChromeRenderViewObserver, where we have a place to dispatch RV messages specific to Chrome.
Review URL: http://codereview.chromium.org/6883177
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83283 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_view_host.cc | 104 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.h | 52 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host_delegate.h | 5 | ||||
-rw-r--r-- | content/browser/renderer_host/render_widget_host.cc | 1 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 4 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.h | 2 | ||||
-rw-r--r-- | content/common/notification_type.h | 6 | ||||
-rw-r--r-- | content/common/view_messages.h | 2 |
8 files changed, 5 insertions, 171 deletions
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index be3942b..2d661ed 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -15,15 +15,10 @@ #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/dom_operation_notification_details.h" #include "chrome/browser/net/predictor_api.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/icon_messages.h" #include "chrome/common/render_messages.h" -#include "chrome/common/translate_errors.h" -#include "chrome/common/url_constants.h" #include "content/browser/browser_message_filter.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/content_browser_client.h" @@ -44,6 +39,7 @@ #include "content/common/notification_service.h" #include "content/common/notification_type.h" #include "content/common/result_codes.h" +#include "content/common/url_constants.h" #include "content/common/view_messages.h" #include "net/base/net_util.h" #include "net/url_request/url_request_context_getter.h" @@ -555,21 +551,6 @@ void RenderViewHost::SelectAll() { UserMetrics::RecordAction(UserMetricsAction("SelectAll")); } -int RenderViewHost::DownloadFavicon(const GURL& url, int image_size) { - if (!url.is_valid()) { - NOTREACHED(); - return 0; - } - static int next_id = 1; - int id = next_id++; - Send(new IconMsg_DownloadFavicon(routing_id(), id, url, image_size)); - return id; -} - -void RenderViewHost::CaptureSnapshot() { - Send(new ViewMsg_CaptureSnapshot(routing_id())); -} - void RenderViewHost::JavaScriptMessageBoxClosed(IPC::Message* reply_msg, bool success, const std::wstring& prompt) { @@ -663,14 +644,6 @@ void RenderViewHost::UpdateWebPreferences(const WebPreferences& prefs) { Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs)); } -void RenderViewHost::InstallMissingPlugin() { - Send(new ViewMsg_InstallMissingPlugin(routing_id())); -} - -void RenderViewHost::LoadBlockedPlugins() { - Send(new ViewMsg_LoadBlockedPlugins(routing_id())); -} - void RenderViewHost::FilesSelectedInChooser( const std::vector<FilePath>& files) { // Grant the security access requested to the given files. @@ -743,7 +716,6 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateEncoding, OnMsgUpdateEncoding) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL) - IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnMsgScreenshot) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSetting, OnUpdateInspectorSetting) IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) @@ -760,8 +732,6 @@ bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL) IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, OnMsgDidContentsPreferredSizeChange) - IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, - OnMsgDomOperationResponse) IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, OnMsgForwardMessageToExternalHost) IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) @@ -992,13 +962,6 @@ void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, Send(new ViewMsg_UpdateTargetURL_ACK(routing_id())); } -void RenderViewHost::OnMsgScreenshot(const SkBitmap& bitmap) { - NotificationService::current()->Notify( - NotificationType::TAB_SNAPSHOT_TAKEN, - Source<RenderViewHost>(this), - Details<const SkBitmap>(&bitmap)); -} - void RenderViewHost::OnUpdateInspectorSetting( const std::string& key, const std::string& value) { delegate_->UpdateInspectorSetting(key, value); @@ -1075,17 +1038,6 @@ void RenderViewHost::OnMsgDidContentsPreferredSizeChange( view->UpdatePreferredSize(new_size); } -void RenderViewHost::OnMsgDomOperationResponse( - const std::string& json_string, int automation_id) { - delegate_->DomOperationResponse(json_string, automation_id); - - // We also fire a notification for more loosely-coupled use cases. - DomOperationNotificationDetails details(json_string, automation_id); - NotificationService::current()->Notify( - NotificationType::DOM_OPERATION_RESPONSE, Source<RenderViewHost>(this), - Details<DomOperationNotificationDetails>(&details)); -} - void RenderViewHost::OnMsgForwardMessageToExternalHost( const std::string& message, const std::string& origin, const std::string& target) { @@ -1228,20 +1180,6 @@ void RenderViewHost::OnUserGesture() { delegate_->OnUserGesture(); } -void RenderViewHost::GetAllSavableResourceLinksForCurrentPage( - const GURL& page_url) { - Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id(), - page_url)); -} - -void RenderViewHost::GetSerializedHtmlDataForCurrentPageWithLocalLinks( - const std::vector<GURL>& links, - const std::vector<FilePath>& local_paths, - const FilePath& local_directory_name) { - Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks( - routing_id(), links, local_paths, local_directory_name)); -} - void RenderViewHost::OnMsgShouldCloseACK(bool proceed) { StopHangMonitorTimeout(); // If this renderer navigated while the beforeunload request was in flight, we @@ -1348,13 +1286,6 @@ void RenderViewHost::ForwardEditCommandsForNextKeyEvent( Send(new ViewMsg_SetEditCommandsForNextKeyEvent(routing_id(), edit_commands)); } -void RenderViewHost::ForwardMessageFromExternalHost(const std::string& message, - const std::string& origin, - const std::string& target) { - Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), message, origin, - target)); -} - void RenderViewHost::UpdateBrowserWindowId(int window_id) { Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); } @@ -1386,35 +1317,6 @@ void RenderViewHost::DidCancelPopupMenu() { } #endif -void RenderViewHost::SearchBoxChange(const string16& value, - bool verbatim, - int selection_start, - int selection_end) { - Send(new ViewMsg_SearchBoxChange( - routing_id(), value, verbatim, selection_start, selection_end)); -} - -void RenderViewHost::SearchBoxSubmit(const string16& value, - bool verbatim) { - Send(new ViewMsg_SearchBoxSubmit(routing_id(), value, verbatim)); -} - -void RenderViewHost::SearchBoxCancel() { - Send(new ViewMsg_SearchBoxCancel(routing_id())); -} - -void RenderViewHost::SearchBoxResize(const gfx::Rect& search_box_bounds) { - Send(new ViewMsg_SearchBoxResize(routing_id(), search_box_bounds)); -} - -void RenderViewHost::DetermineIfPageSupportsInstant(const string16& value, - bool verbatim, - int selection_start, - int selection_end) { - Send(new ViewMsg_DetermineIfPageSupportsInstant( - routing_id(), value, verbatim, selection_start, selection_end)); -} - void RenderViewHost::FilterURL(ChildProcessSecurityPolicy* policy, int renderer_id, GURL* url) { @@ -1436,10 +1338,6 @@ void RenderViewHost::FilterURL(ChildProcessSecurityPolicy* policy, } } -void RenderViewHost::JavaScriptStressTestControl(int cmd, int param) { - Send(new ViewMsg_JavaScriptStressTestControl(routing_id(), cmd, param)); -} - void RenderViewHost::OnAccessibilityNotifications( const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { if (view()) diff --git a/content/browser/renderer_host/render_view_host.h b/content/browser/renderer_host/render_view_host.h index 281bfeb..904fe4c 100644 --- a/content/browser/renderer_host/render_view_host.h +++ b/content/browser/renderer_host/render_view_host.h @@ -278,14 +278,6 @@ class RenderViewHost : public RenderWidgetHost { void Delete(); void SelectAll(); - // Downloads an image notifying the favicon delegate appropriately. The - // returned integer uniquely identifies the download for the lifetime of the - // browser. - int DownloadFavicon(const GURL& url, int image_size); - - // Captures a snapshot of the page. - void CaptureSnapshot(); - // Notifies the RenderView that the JavaScript message that was shown was // closed by the user. void JavaScriptMessageBoxClosed(IPC::Message* reply_msg, @@ -348,17 +340,6 @@ class RenderViewHost : public RenderWidgetHost { // Update render view specific (WebKit) preferences. void UpdateWebPreferences(const WebPreferences& prefs); - // Request the Renderer to ask the default plugin to start installation of - // missing plugin. Called by PluginInstallerInfoBarDelegate. - void InstallMissingPlugin(); - - // Load all blocked plugins in the RenderView. - void LoadBlockedPlugins(); - - // Get all savable resource links from current webpage, include main - // frame and sub-frame. - void GetAllSavableResourceLinksForCurrentPage(const GURL& page_url); - // Get html data by serializing all frames of current page with lists // which contain all resource links that have local copy. // The parameter links contain original URLs of all saved links. @@ -388,11 +369,6 @@ class RenderViewHost : public RenderWidgetHost { sudden_termination_allowed_ = enabled; } - // Forward a message from external host to chrome renderer. - void ForwardMessageFromExternalHost(const std::string& message, - const std::string& origin, - const std::string& target); - // Message the renderer that we should be counted as a new document and not // as a popup. void DisassociateFromPopupCount(); @@ -450,26 +426,6 @@ class RenderViewHost : public RenderWidgetHost { void DidCancelPopupMenu(); #endif - // SearchBox notifications. - void SearchBoxChange(const string16& value, - bool verbatim, - int selection_start, - int selection_end); - void SearchBoxSubmit(const string16& value, - bool verbatim); - void SearchBoxCancel(); - void SearchBoxResize(const gfx::Rect& search_box_bounds); - void DetermineIfPageSupportsInstant(const string16& value, - bool verbatim, - int selection_start, - int selection_end); - - // Send a notification to the V8 JavaScript engine to change its parameters - // while performing stress testing. |cmd| is one of the values defined by - // |ViewHostMsg_JavaScriptStressTestControl_Commands|, which is defined - // in render_messages.h. - void JavaScriptStressTestControl(int cmd, int param); - #if defined(UNIT_TEST) // These functions shouldn't be necessary outside of testing. @@ -525,7 +481,6 @@ class RenderViewHost : public RenderWidgetHost { void OnMsgUpdateTitle(int32 page_id, const std::wstring& title); void OnMsgUpdateEncoding(const std::string& encoding); void OnMsgUpdateTargetURL(int32 page_id, const GURL& url); - void OnMsgScreenshot(const SkBitmap& bitmap); void OnMsgClose(); void OnMsgRequestMove(const gfx::Rect& pos); void OnMsgDidStartLoading(); @@ -533,17 +488,10 @@ class RenderViewHost : public RenderWidgetHost { void OnMsgDidChangeLoadProgress(double load_progress); void OnMsgDocumentAvailableInMainFrame(); void OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id); - void OnMsgUpdateFaviconURL(int32 page_id, const GURL& icon_url); - void OnMsgDidDownloadFavicon(int id, - const GURL& image_url, - bool errored, - const SkBitmap& image_data); void OnMsgContextMenu(const ContextMenuParams& params); void OnMsgOpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition); void OnMsgDidContentsPreferredSizeChange(const gfx::Size& new_size); - void OnMsgDomOperationResponse(const std::string& json_string, - int automation_id); void OnMsgForwardMessageToExternalHost(const std::string& message, const std::string& origin, const std::string& target); diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index f95a76d..e4319c5 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -483,11 +483,6 @@ class RenderViewHostDelegate : public IPC::Channel::Listener { const GURL& referrer, WindowOpenDisposition disposition) {} - // A DOM automation operation completed. The result of the operation is - // expressed in a json string. - virtual void DomOperationResponse(const std::string& json_string, - int automation_id) {} - // A message for external host. By default we ignore such messages. // |receiver| can be a receiving script and |message| is any // arbitrary string that makes sense to the receiver. diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc index 63ddd40..77db54b 100644 --- a/content/browser/renderer_host/render_widget_host.cc +++ b/content/browser/renderer_host/render_widget_host.cc @@ -10,7 +10,6 @@ #include "base/metrics/histogram.h" #include "chrome/browser/accessibility/browser_accessibility_state.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/render_messages.h" #include "content/browser/gpu_process_host.h" #include "content/browser/renderer_host/backing_store.h" #include "content/browser/renderer_host/backing_store_manager.h" diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 2490930..677eb27 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -2005,10 +2005,6 @@ void TabContents::RequestOpenURL(const GURL& url, const GURL& referrer, } } -void TabContents::DomOperationResponse(const std::string& json_string, - int automation_id) { -} - void TabContents::ProcessExternalHostMessage(const std::string& message, const std::string& origin, const std::string& target) { diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h index f690393..0d54825 100644 --- a/content/browser/tab_contents/tab_contents.h +++ b/content/browser/tab_contents/tab_contents.h @@ -804,8 +804,6 @@ class TabContents : public PageNavigator, int32 page_id); virtual void RequestOpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition); - virtual void DomOperationResponse(const std::string& json_string, - int automation_id); virtual void ProcessExternalHostMessage(const std::string& message, const std::string& origin, const std::string& target); diff --git a/content/common/notification_type.h b/content/common/notification_type.h index f0cf976..d887d40 100644 --- a/content/common/notification_type.h +++ b/content/common/notification_type.h @@ -263,9 +263,9 @@ class NotificationType { PAGE_TRANSLATED, // Sent after the renderer returns a snapshot of tab contents. - // The source (Source<RenderViewHost>) is the RenderViewHost for which the - // snapshot was generated and the details (Details<const SkBitmap>) is the - // actual snapshot. + // The source (Source<TabContentsWrapper>) is the RenderViewHost for which + // the snapshot was generated and the details (Details<const SkBitmap>) is + // the actual snapshot. TAB_SNAPSHOT_TAKEN, // The user has changed the browser theme. There are no details. diff --git a/content/common/view_messages.h b/content/common/view_messages.h index c7658126..f8be887 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -1571,7 +1571,7 @@ IPC_MESSAGE_CONTROL1(ViewHostMsg_ForwardToWorker, IPC_MESSAGE_CONTROL1(ViewHostMsg_CancelCreateDedicatedWorker, int /* route_id */) -// Tells the browser that a specific Appcache manifest in the current page +// Tells the browser that a specific Appcache manifest in the current page // was accessed. IPC_MESSAGE_ROUTED2(ViewHostMsg_AppCacheAccessed, GURL /* manifest url */, |