summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 19:48:37 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 19:48:37 +0000
commit2879092e01ea4ebb93c1b80925c81e059b24607b (patch)
tree53638b170c3c9c3146d13238d1ed20993cdb4257 /chrome/browser/tab_contents
parent12a6f036f3859f88b439dba009172f5c1dd03dc9 (diff)
downloadchromium_src-2879092e01ea4ebb93c1b80925c81e059b24607b.zip
chromium_src-2879092e01ea4ebb93c1b80925c81e059b24607b.tar.gz
chromium_src-2879092e01ea4ebb93c1b80925c81e059b24607b.tar.bz2
Changing ForwardMessageToExternalHost to postMessage and passing a proper
MessageEvent object to the onmessage handler. Also adding support for origin and target parameters. The origin parameter is implicit but target can be specified when calling postMessage. If no target is specified we default to "*". At the moment I'm only allowing target == "*" messages to pass through since I haven't implemented support for matching more complicated patterns :) Review URL: http://codereview.chromium.org/40128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11275 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/tab_contents_delegate.h5
-rw-r--r--chrome/browser/tab_contents/web_contents.cc6
-rw-r--r--chrome/browser/tab_contents/web_contents.h4
3 files changed, 11 insertions, 4 deletions
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index f97a6dc50..74cee1e 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -138,7 +138,10 @@ class TabContentsDelegate : public PageNavigator {
}
// Send IPC to external host. Default implementation is do nothing.
- virtual void ForwardMessageToExternalHost(const std::string& message) {}
+ virtual void ForwardMessageToExternalHost(const std::string& message,
+ const std::string& origin,
+ const std::string& target) {
+ }
// If the delegate is hosting tabs externally.
virtual bool IsExternalTabContainer() const { return false; }
diff --git a/chrome/browser/tab_contents/web_contents.cc b/chrome/browser/tab_contents/web_contents.cc
index affa867..8f1a5ea 100644
--- a/chrome/browser/tab_contents/web_contents.cc
+++ b/chrome/browser/tab_contents/web_contents.cc
@@ -1007,9 +1007,11 @@ void WebContents::DomOperationResponse(const std::string& json_string,
Details<DomOperationNotificationDetails>(&details));
}
-void WebContents::ProcessExternalHostMessage(const std::string& message) {
+void WebContents::ProcessExternalHostMessage(const std::string& message,
+ const std::string& origin,
+ const std::string& target) {
if (delegate())
- delegate()->ForwardMessageToExternalHost(message);
+ delegate()->ForwardMessageToExternalHost(message, origin, target);
}
void WebContents::GoToEntryAtOffset(int offset) {
diff --git a/chrome/browser/tab_contents/web_contents.h b/chrome/browser/tab_contents/web_contents.h
index e1d21de..8496841 100644
--- a/chrome/browser/tab_contents/web_contents.h
+++ b/chrome/browser/tab_contents/web_contents.h
@@ -334,7 +334,9 @@ class WebContents : public TabContents,
WindowOpenDisposition disposition);
virtual void DomOperationResponse(const std::string& json_string,
int automation_id);
- virtual void ProcessExternalHostMessage(const std::string& message);
+ virtual void ProcessExternalHostMessage(const std::string& message,
+ const std::string& origin,
+ const std::string& target);
virtual void GoToEntryAtOffset(int offset);
virtual void GetHistoryListCount(int* back_list_count,
int* forward_list_count);