diff options
author | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 20:12:42 +0000 |
---|---|---|
committer | joshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 20:12:42 +0000 |
commit | 9a2051dfb8a1b02f0ae06bd03c94f8d7945db669 (patch) | |
tree | 3e3c3b91866a6439fcc22fa52d9852de304815d2 /chrome/browser | |
parent | 849890b62b75f95cf91ebd3fe49f1525ff6595bd (diff) | |
download | chromium_src-9a2051dfb8a1b02f0ae06bd03c94f8d7945db669.zip chromium_src-9a2051dfb8a1b02f0ae06bd03c94f8d7945db669.tar.gz chromium_src-9a2051dfb8a1b02f0ae06bd03c94f8d7945db669.tar.bz2 |
Code to facilitate sending message to external host.
Note that at this time the parameters to the message
are still tentative. The call goes as a sync call from
renderer to the browser. From then onwards it happens
async and no return value is available yet.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/render_view_host.cc | 8 | ||||
-rw-r--r-- | chrome/browser/render_view_host.h | 2 | ||||
-rw-r--r-- | chrome/browser/render_view_host_delegate.h | 6 | ||||
-rw-r--r-- | chrome/browser/web_contents.cc | 6 | ||||
-rw-r--r-- | chrome/browser/web_contents.h | 2 |
5 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc index 0b84911..a6b0f9d 100644 --- a/chrome/browser/render_view_host.cc +++ b/chrome/browser/render_view_host.cc @@ -665,6 +665,8 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { OnMsgDomOperationResponse) IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend, OnMsgDOMUISend) + IPC_MESSAGE_HANDLER(ViewHostMsg_ExternalHostMessage, + OnMsgExternalHostMessage) #ifdef CHROME_PERSONALIZATION IPC_MESSAGE_HANDLER(ViewHostMsg_PersonalizationEvent, OnPersonalizationEvent) @@ -1013,6 +1015,12 @@ void RenderViewHost::OnMsgDOMUISend( delegate_->ProcessDOMUIMessage(message, content); } +void RenderViewHost::OnMsgExternalHostMessage( + const std::string& receiver, + const std::string& message) { + delegate_->ProcessExternalHostMessage(receiver, message); +} + #ifdef CHROME_PERSONALIZATION void RenderViewHost::OnPersonalizationEvent(const std::string& message, const std::string& content) { diff --git a/chrome/browser/render_view_host.h b/chrome/browser/render_view_host.h index b546331..2faf76a 100644 --- a/chrome/browser/render_view_host.h +++ b/chrome/browser/render_view_host.h @@ -459,6 +459,8 @@ class RenderViewHost : public RenderWidgetHost { int automation_id); void OnMsgDOMUISend(const std::string& message, const std::string& content); + void OnMsgExternalHostMessage(const std::string& receiver, + const std::string& message); #ifdef CHROME_PERSONALIZATION void OnPersonalizationEvent(const std::string& message, const std::string& content); diff --git a/chrome/browser/render_view_host_delegate.h b/chrome/browser/render_view_host_delegate.h index 959f427..c6cc9a2 100644 --- a/chrome/browser/render_view_host_delegate.h +++ b/chrome/browser/render_view_host_delegate.h @@ -220,6 +220,12 @@ class RenderViewHostDelegate { virtual void ProcessDOMUIMessage(const std::string& message, const std::string& content) { } + // 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. + virtual void ProcessExternalHostMessage(const std::string& receiver, + const std::string& message) { } + // Navigate to the history entry for the given offset from the current // position within the NavigationController. Makes no change if offset is // not valid. diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc index 32b1ecd..96834dc 100644 --- a/chrome/browser/web_contents.cc +++ b/chrome/browser/web_contents.cc @@ -1988,6 +1988,12 @@ void WebContents::DomOperationResponse(const std::string& json_string, Details<DomOperationNotificationDetails>(&details)); } +void WebContents::ProcessExternalHostMessage(const std::string& receiver, + const std::string& message) { + if (delegate()) + delegate()->SendExternalHostMessage(receiver, message); +} + void WebContents::GoToEntryAtOffset(int offset) { if (!controller()) return; diff --git a/chrome/browser/web_contents.h b/chrome/browser/web_contents.h index b61eb70..09a07d0 100644 --- a/chrome/browser/web_contents.h +++ b/chrome/browser/web_contents.h @@ -427,6 +427,8 @@ class WebContents : public TabContents, WindowOpenDisposition disposition); virtual void DomOperationResponse(const std::string& json_string, int automation_id); + virtual void ProcessExternalHostMessage(const std::string& receiver, + const std::string& message); virtual void GoToEntryAtOffset(int offset); virtual void GetHistoryListCount(int* back_list_count, int* forward_list_count); |