summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/automation_provider.cc11
-rw-r--r--chrome/browser/automation/automation_provider.h6
-rw-r--r--chrome/browser/external_tab_container.cc12
-rw-r--r--chrome/browser/external_tab_container.h4
-rw-r--r--chrome/browser/render_view_host.cc21
-rw-r--r--chrome/browser/render_view_host.h18
-rw-r--r--chrome/browser/web_contents.cc2
-rw-r--r--chrome/common/render_messages_internal.h12
-rw-r--r--chrome/renderer/external_host_bindings.cc32
-rw-r--r--chrome/renderer/external_host_bindings.h46
-rw-r--r--chrome/renderer/render_view.cc25
-rw-r--r--chrome/renderer/render_view.h10
-rw-r--r--chrome/test/automation/automation_messages_internal.h6
-rw-r--r--chrome/test/automation/tab_proxy.cc10
-rw-r--r--chrome/test/automation/tab_proxy.h6
15 files changed, 110 insertions, 111 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index fafdd5b..fecbfa7 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -772,8 +772,8 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
GetConstrainedWindowBounds)
IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPageRequest,
HandleOpenFindInPageRequest)
- IPC_MESSAGE_HANDLER(AutomationMsg_PostMessage,
- OnPostMessage)
+ IPC_MESSAGE_HANDLER(AutomationMsg_HandleMessageFromExternalHost,
+ OnMessageFromExternalHost)
IPC_END_MESSAGE_MAP()
}
@@ -2205,9 +2205,8 @@ void AutomationProvider::AutocompleteEditIsQueryInProgress(
message.routing_id(), success, query_in_progress));
}
-void AutomationProvider::OnPostMessage(int handle,
- const std::string& target,
- const std::string& message) {
+void AutomationProvider::OnMessageFromExternalHost(
+ int handle, const std::string& target, const std::string& message) {
if (tab_tracker_->ContainsHandle(handle)) {
NavigationController* tab = tab_tracker_->GetResource(handle);
if (!tab) {
@@ -2231,7 +2230,7 @@ void AutomationProvider::OnPostMessage(int handle,
return;
}
- view_host->PostMessage(target, message);
+ view_host->ForwardMessageFromExternalHost(target, message);
}
}
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 1fac8fa..1aadbc4 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -311,9 +311,9 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
void AutocompleteEditGetMatches(const IPC::Message& message,
int autocomplete_edit_handle);
- // Handler for PostMessage sent by the automation client.
- void OnPostMessage(int handle, const std::string& target,
- const std::string& message);
+ // Handler for a message sent by the automation client.
+ void OnMessageFromExternalHost(int handle, const std::string& target,
+ const std::string& message);
// Callback for history redirect queries.
virtual void OnRedirectQueryComplete(
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index bc25861..1bd3dd8 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -35,6 +35,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents.h"
#include "chrome/browser/tab_contents_container_view.h"
+#include "chrome/browser/web_contents.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/win_util.h"
#include "chrome/views/hwnd_view_container.h"
@@ -89,6 +90,11 @@ bool ExternalTabContainer::Init(Profile* profile) {
}
tab_contents_->SetupController(profile);
tab_contents_->set_delegate(this);
+
+ WebContents* web_conents = tab_contents_->AsWebContents();
+ if (web_conents)
+ web_conents->render_view_host()->AllowExternalHostBindings();
+
// Create a TabContentsContainerView to handle focus cycling using Tab and
// Shift-Tab.
// TODO(sanjeevr): We need to create a dummy FocusTraversable object to
@@ -238,11 +244,11 @@ void ExternalTabContainer::DidNavigate(NavigationType nav_type,
}
}
-void ExternalTabContainer::SendExternalHostMessage(const std::string& receiver,
- const std::string& message) {
+void ExternalTabContainer::ForwardMessageToExternalHost(
+ const std::string& receiver, const std::string& message) {
if(automation_) {
automation_->Send(
- new AutomationMsg_SendExternalHostMessage(0, receiver, message));
+ new AutomationMsg_ForwardMessageToExternalHost(0, receiver, message));
}
}
diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h
index 304d179..8b368dd 100644
--- a/chrome/browser/external_tab_container.h
+++ b/chrome/browser/external_tab_container.h
@@ -105,8 +105,8 @@ class ExternalTabContainer : public TabContentsDelegate,
virtual void ToolbarSizeChanged(TabContents* source, bool is_animating);
virtual void DidNavigate(NavigationType nav_type,
int relative_navigation_offet);
- virtual void SendExternalHostMessage(const std::string& receiver,
- const std::string& message);
+ virtual void ForwardMessageToExternalHost(const std::string& receiver,
+ const std::string& message);
// Notification service callback.
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc
index 0a6912b..4a3339f 100644
--- a/chrome/browser/render_view_host.cc
+++ b/chrome/browser/render_view_host.cc
@@ -101,6 +101,7 @@ RenderViewHost::RenderViewHost(SiteInstance* instance,
: RenderWidgetHost(instance->GetProcess(), routing_id),
instance_(instance),
enable_dom_ui_bindings_(false),
+ enable_external_host_bindings_(false),
delegate_(delegate),
renderer_initialized_(false),
waiting_for_drag_context_response_(false),
@@ -175,8 +176,8 @@ bool RenderViewHost::CreateRenderView() {
// If it's enabled, tell the renderer to set up the Javascript bindings for
// sending messages back to the browser.
- if (enable_dom_ui_bindings_)
- Send(new ViewMsg_AllowDOMUIBindings(routing_id_));
+ Send(new ViewMsg_AllowBindings(
+ routing_id_, enable_dom_ui_bindings_, enable_external_host_bindings_));
// Let our delegate know that we created a RenderView.
delegate_->RendererCreated(this);
@@ -571,6 +572,10 @@ void RenderViewHost::AllowDOMUIBindings() {
RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings(process()->host_id());
}
+void RenderViewHost::AllowExternalHostBindings() {
+ enable_external_host_bindings_ = true;
+}
+
void RenderViewHost::SetDOMUIProperty(const std::string& name,
const std::string& value) {
DCHECK(enable_dom_ui_bindings_);
@@ -665,8 +670,8 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) {
OnMsgDomOperationResponse)
IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend,
OnMsgDOMUISend)
- IPC_MESSAGE_HANDLER(ViewHostMsg_ExternalHostMessage,
- OnMsgExternalHostMessage)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost,
+ OnMsgForwardMessageToExternalHost)
#ifdef CHROME_PERSONALIZATION
IPC_MESSAGE_HANDLER(ViewHostMsg_PersonalizationEvent,
OnPersonalizationEvent)
@@ -1015,7 +1020,7 @@ void RenderViewHost::OnMsgDOMUISend(
delegate_->ProcessDOMUIMessage(message, content);
}
-void RenderViewHost::OnMsgExternalHostMessage(
+void RenderViewHost::OnMsgForwardMessageToExternalHost(
const std::string& receiver,
const std::string& message) {
delegate_->ProcessExternalHostMessage(receiver, message);
@@ -1220,7 +1225,7 @@ void RenderViewHost::OnDebugDisconnect() {
}
}
-void RenderViewHost::PostMessage(const std::string& target,
- const std::string& message) {
- Send(new ViewMsg_PostMessage(routing_id_, target, message));
+void RenderViewHost::ForwardMessageFromExternalHost(
+ const std::string& target, const std::string& message) {
+ Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message));
}
diff --git a/chrome/browser/render_view_host.h b/chrome/browser/render_view_host.h
index dcba399..e80f111 100644
--- a/chrome/browser/render_view_host.h
+++ b/chrome/browser/render_view_host.h
@@ -333,6 +333,10 @@ class RenderViewHost : public RenderWidgetHost {
// process.
void AllowDomAutomationBindings();
+ // Tell the render view to allow the javascript access to
+ // the external host via automation.
+ void AllowExternalHostBindings();
+
// Tell the render view to expose DOM bindings so that the JS content
// can send JSON-encoded data back to the browser process.
// This is used for HTML-based UI.
@@ -398,9 +402,9 @@ class RenderViewHost : public RenderWidgetHost {
// and we're necessarily leaving the page.
void UnloadListenerHasFired() { has_unload_listener_ = false; }
- // Posts a message to the renderer.
- void PostMessage(const std::string& target,
- const std::string& message);
+ // Forward a message from external host to chrome renderer.
+ void ForwardMessageFromExternalHost(const std::string& target,
+ const std::string& message);
#ifdef CHROME_PERSONALIZATION
HostPersonalization personalization() {
@@ -463,8 +467,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);
+ void OnMsgForwardMessageToExternalHost(const std::string& receiver,
+ const std::string& message);
#ifdef CHROME_PERSONALIZATION
void OnPersonalizationEvent(const std::string& message,
const std::string& content);
@@ -555,6 +559,10 @@ class RenderViewHost : public RenderWidgetHost {
// sending messages back to the browser.
bool enable_dom_ui_bindings_;
+ // True if javascript access to the external host (through
+ // automation) is allowed.
+ bool enable_external_host_bindings_;
+
// Handle to an event that's set when the page is showing a modal dialog box
// (or equivalent constrained window). The renderer and plugin processes
// check this to know if they should pump messages/tasks then.
diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc
index ccaf94d..30249e8 100644
--- a/chrome/browser/web_contents.cc
+++ b/chrome/browser/web_contents.cc
@@ -1998,7 +1998,7 @@ void WebContents::DomOperationResponse(const std::string& json_string,
void WebContents::ProcessExternalHostMessage(const std::string& receiver,
const std::string& message) {
if (delegate())
- delegate()->SendExternalHostMessage(receiver, message);
+ delegate()->ForwardMessageToExternalHost(receiver, message);
}
void WebContents::GoToEntryAtOffset(int offset) {
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 7ce3daf..0cbbe3e 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -308,7 +308,9 @@ IPC_BEGIN_MESSAGES(View, 1)
// Used to tell a render view whether it should expose DOM UI bindings
// that allow JS content in the DOM to send a JSON-encoded value to the
// browser process. This is for HTML-based UI.
- IPC_MESSAGE_ROUTED0(ViewMsg_AllowDOMUIBindings)
+ IPC_MESSAGE_ROUTED2(ViewMsg_AllowBindings,
+ bool /* enable_dom_ui_bindings */,
+ bool /* enable_external_host_bindings */)
// Tell the renderer to add a property to the DOMUI binding object. This
// only works if we allowed DOMUI bindings.
@@ -437,7 +439,7 @@ IPC_BEGIN_MESSAGES(View, 1)
gfx::Size /* The view size to be repainted */)
// Posts a message to the renderer.
- IPC_MESSAGE_ROUTED2(ViewMsg_PostMessage,
+ IPC_MESSAGE_ROUTED2(ViewMsg_HandleMessageFromExternalHost,
std::string /* The target for the message */,
std::string /* The message */)
@@ -730,8 +732,10 @@ IPC_BEGIN_MESSAGES(ViewHost, 2)
// A message for an external host.
// |receiver| can be a receiving script and |message| is any
- // arbitrary string that makes sense to the receiver.
- IPC_MESSAGE_ROUTED2(ViewHostMsg_ExternalHostMessage,
+ // arbitrary string that makes sense to the receiver. For
+ // example, a user of automation can use it to execute a script
+ // in the form of javascript:receiver("message");
+ IPC_MESSAGE_ROUTED2(ViewHostMsg_ForwardMessageToExternalHost,
std::string /* receiver */,
std::string /* message */)
diff --git a/chrome/renderer/external_host_bindings.cc b/chrome/renderer/external_host_bindings.cc
index ffcd5fd..9ff8a54 100644
--- a/chrome/renderer/external_host_bindings.cc
+++ b/chrome/renderer/external_host_bindings.cc
@@ -29,22 +29,16 @@
#include "chrome/renderer/external_host_bindings.h"
-#include "base/json_writer.h"
-#include "base/scoped_handle.h"
#include "base/values.h"
#include "chrome/common/render_messages.h"
-#include "chrome/common/stl_util-inl.h"
-ExternalHostBindings::ExternalHostBindings() : routing_id_(0), sender_(NULL) {
- BindMethod("postMessage", &ExternalHostBindings::postMessage);
+void ExternalHostBindings::BindMethods() {
+ BindMethod("ForwardMessageToExternalHost",
+ &ExternalHostBindings::ForwardMessageToExternalHost);
}
-ExternalHostBindings::~ExternalHostBindings() {
- STLDeleteContainerPointers(properties_.begin(), properties_.end());
-}
-
-void ExternalHostBindings::postMessage(const CppArgumentList& args,
- CppVariant* result) {
+void ExternalHostBindings::ForwardMessageToExternalHost(
+ const CppArgumentList& args, CppVariant* result) {
// We expect at least a string message identifier, and optionally take
// an object parameter. If we get anything else we bail.
if (args.size() < 2)
@@ -54,17 +48,9 @@ void ExternalHostBindings::postMessage(const CppArgumentList& args,
if (!args[0].isString() && !args[1].isString())
return;
- const std::string receiver = args[0].ToString();
- const std::string message = args[1].ToString();
-
- sender_->Send(
- new ViewHostMsg_ExternalHostMessage(routing_id_, receiver, message));
-}
+ const std::string& receiver = args[0].ToString();
+ const std::string& message = args[1].ToString();
-void ExternalHostBindings::SetProperty(const std::string& name,
- const std::string& value) {
- CppVariant* cpp_value = new CppVariant;
- cpp_value->Set(value);
- BindProperty(name, cpp_value);
- properties_.push_back(cpp_value);
+ sender()->Send(new ViewHostMsg_ForwardMessageToExternalHost(
+ routing_id(), receiver, message));
}
diff --git a/chrome/renderer/external_host_bindings.h b/chrome/renderer/external_host_bindings.h
index dde86af..3c56ee1 100644
--- a/chrome/renderer/external_host_bindings.h
+++ b/chrome/renderer/external_host_bindings.h
@@ -27,48 +27,30 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H__
-#define CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H__
+#ifndef CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_
+#define CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_
#include "chrome/common/ipc_message.h"
-#include "webkit/glue/cpp_bound_class.h"
+#include "dom_ui_bindings.h"
// ExternalHostBindings is the class backing the "externalHost" object
// accessible from Javascript
//
// We expose one function, for sending a message to the external host:
-// postMessage(String receiver, String message);
-class ExternalHostBindings : public CppBoundClass {
+// ForwardMessageToExternalHost(String receiver, String message);
+class ExternalHostBindings : public DOMBoundBrowserObject {
public:
- ExternalHostBindings();
- ~ExternalHostBindings();
+ ExternalHostBindings() { BindMethods(); }
+ virtual ~ExternalHostBindings() {};
- // The postMessage() function provided to Javascript.
- void postMessage(const CppArgumentList& args, CppVariant* result);
-
- // Set the message channel back to the browser.
- void set_message_sender(IPC::Message::Sender* sender) {
- sender_ = sender;
- }
-
- // Set the routing id for messages back to the browser.
- void set_routing_id(int routing_id) {
- routing_id_ = routing_id;
- }
-
- // Sets a property with the given name and value.
- void SetProperty(const std::string& name, const std::string& value);
+ // DOMBoundBrowserObject implementation.
+ virtual void BindMethods();
+ // The ForwardMessageToExternalHost() function provided to Javascript.
+ void ForwardMessageToExternalHost(const CppArgumentList& args,
+ CppVariant* result);
private:
- // Our channel back to the browser is a message sender
- // and routing id.
- IPC::Message::Sender* sender_;
- int routing_id_;
-
- // The list of properties that have been set. We keep track of this so we
- // can free them on destruction.
- typedef std::vector<CppVariant*> PropertyList;
- PropertyList properties_;
+ DISALLOW_COPY_AND_ASSIGN(ExternalHostBindings);
};
-#endif // CHROME_RENDERER_DOM_UI_BINDINGS_H__
+#endif // CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 41b6ab0..d7ec667 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -335,7 +335,7 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_DragTargetDrop, OnDragTargetDrop)
IPC_MESSAGE_HANDLER(ViewMsg_AllowDomAutomationBindings,
OnAllowDomAutomationBindings)
- IPC_MESSAGE_HANDLER(ViewMsg_AllowDOMUIBindings, OnAllowDOMUIBindings)
+ IPC_MESSAGE_HANDLER(ViewMsg_AllowBindings, OnAllowBindings)
IPC_MESSAGE_HANDLER(ViewMsg_SetDOMUIProperty, OnSetDOMUIProperty)
IPC_MESSAGE_HANDLER(ViewMsg_DragSourceEndedOrMoved, OnDragSourceEndedOrMoved)
IPC_MESSAGE_HANDLER(ViewMsg_DragSourceSystemDragEnded,
@@ -358,7 +358,8 @@ void RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_ShouldClose, OnMsgShouldClose)
IPC_MESSAGE_HANDLER(ViewMsg_ClosePage, OnClosePage)
IPC_MESSAGE_HANDLER(ViewMsg_ThemeChanged, OnThemeChanged)
- IPC_MESSAGE_HANDLER(ViewMsg_PostMessage, OnPostMessage)
+ IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost,
+ OnMessageFromExternalHost)
// Have the super handle all other messages.
IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message))
IPC_END_MESSAGE_MAP()
@@ -1418,10 +1419,11 @@ void RenderView::WindowObjectCleared(WebFrame* webframe) {
dom_ui_bindings_.set_routing_id(routing_id_);
dom_ui_bindings_.BindToJavascript(webframe, L"chrome");
}
-
- external_host_bindings_.set_message_sender(this);
- external_host_bindings_.set_routing_id(routing_id_);
- external_host_bindings_.BindToJavascript(webframe, L"externalHost");
+ if (enable_external_host_bindings_) {
+ external_host_bindings_.set_message_sender(this);
+ external_host_bindings_.set_routing_id(routing_id_);
+ external_host_bindings_.BindToJavascript(webframe, L"externalHost");
+ }
#ifdef CHROME_PERSONALIZATION
Personalization::ConfigureRendererPersonalization(personalization_, this,
@@ -2281,8 +2283,11 @@ void RenderView::OnAllowDomAutomationBindings(bool allow_bindings) {
enable_dom_automation_ = allow_bindings;
}
-void RenderView::OnAllowDOMUIBindings() {
- enable_dom_ui_bindings_ = true;
+void RenderView::OnAllowBindings(bool enable_dom_ui_bindings,
+ bool enable_external_host_bindings)
+{
+ enable_dom_ui_bindings_ = enable_dom_ui_bindings;
+ enable_external_host_bindings_ = enable_external_host_bindings;
}
void RenderView::OnSetDOMUIProperty(const std::string& name,
@@ -2500,8 +2505,8 @@ void RenderView::OnThemeChanged() {
DidInvalidateRect(webwidget_, view_rect);
}
-void RenderView::OnPostMessage(const std::string& target,
- const std::string& message) {
+void RenderView::OnMessageFromExternalHost(
+ const std::string& target, const std::string& message) {
if (message.empty())
return;
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index cecebaa..7d51aa0 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -416,7 +416,8 @@ class RenderView : public RenderWidget, public WebViewDelegate,
void OnDragTargetDrop(const gfx::Point& client_pt,
const gfx::Point& screen_pt);
void OnAllowDomAutomationBindings(bool allow_binding);
- void OnAllowDOMUIBindings();
+ void OnAllowBindings(bool enable_dom_ui_bindings,
+ bool enable_external_host_bindings);
void OnSetDOMUIProperty(const std::string& name, const std::string& value);
void OnSetInitialFocus(bool reverse);
void OnUpdateWebPreferences(const WebPreferences& prefs);
@@ -455,9 +456,9 @@ class RenderView : public RenderWidget, public WebViewDelegate,
// Notification about ui theme changes.
void OnThemeChanged();
- // Handles messages posted by the browser.
- void OnPostMessage(const std::string& target,
- const std::string& message);
+ // Handles messages posted from automation.
+ void OnMessageFromExternalHost(const std::string& target,
+ const std::string& message);
// Switches the frame's CSS media type to "print" and calculate the number of
// printed pages that are to be expected. |frame| will be used to calculate
@@ -521,6 +522,7 @@ class RenderView : public RenderWidget, public WebViewDelegate,
ExternalJSObject external_js_object_;
// External host exposed through automation controller.
+ bool enable_external_host_bindings_;
ExternalHostBindings external_host_bindings_;
// The last gotten main frame's encoding.
diff --git a/chrome/test/automation/automation_messages_internal.h b/chrome/test/automation/automation_messages_internal.h
index 9c029c4..d05f82e 100644
--- a/chrome/test/automation/automation_messages_internal.h
+++ b/chrome/test/automation/automation_messages_internal.h
@@ -737,8 +737,8 @@ IPC_BEGIN_MESSAGES(Automation, 0)
IPC_MESSAGE_ROUTED1(AutomationMsg_OpenFindInPageRequest,
int /* tab_handle */)
- // Posts a message to the chrome renderer.
- IPC_MESSAGE_ROUTED3(AutomationMsg_PostMessage,
+ // Posts a message from external host to chrome renderer.
+ IPC_MESSAGE_ROUTED3(AutomationMsg_HandleMessageFromExternalHost,
int /* automation handle */,
std::string /* target */,
std::string /* message */ )
@@ -746,7 +746,7 @@ IPC_BEGIN_MESSAGES(Automation, 0)
// A message for an external host.
// |receiver| can be a receiving script and |message| is any
// arbitrary string that makes sense to the receiver.
- IPC_MESSAGE_ROUTED2(AutomationMsg_SendExternalHostMessage,
+ IPC_MESSAGE_ROUTED2(AutomationMsg_ForwardMessageToExternalHost,
std::string /* receiver*/,
std::string /* message*/)
diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc
index 6171ddb..7c82b5c 100644
--- a/chrome/test/automation/tab_proxy.cc
+++ b/chrome/test/automation/tab_proxy.cc
@@ -929,13 +929,15 @@ bool TabProxy::SavePage(const std::wstring& file_name,
return succeeded;
}
-void TabProxy::PostMessage(AutomationHandle handle,
- const std::string& target,
- const std::string& message) {
+void TabProxy::HandleMessageFromExternalHost(AutomationHandle handle,
+ const std::string& target,
+ const std::string& message) {
if (!is_valid())
return;
bool succeeded =
- sender_->Send(new AutomationMsg_PostMessage(0, handle, target, message));
+ sender_->Send(new AutomationMsg_HandleMessageFromExternalHost(0, handle,
+ target,
+ message));
DCHECK(succeeded);
}
diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h
index 24f2cb3..bbb96d0 100644
--- a/chrome/test/automation/tab_proxy.h
+++ b/chrome/test/automation/tab_proxy.h
@@ -266,9 +266,9 @@ class TabProxy : public AutomationResourceProxy {
SavePackage::SavePackageType type);
// Posts a message to the external tab.
- void PostMessage(AutomationHandle handle,
- const std::string& target,
- const std::string& message);
+ void HandleMessageFromExternalHost(AutomationHandle handle,
+ const std::string& target,
+ const std::string& message);
private:
DISALLOW_EVIL_CONSTRUCTORS(TabProxy);