diff options
author | iyengar@google.com <iyengar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 21:41:39 +0000 |
---|---|---|
committer | iyengar@google.com <iyengar@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-15 21:41:39 +0000 |
commit | fa83e761550a9ef5f33be95238da1d12e75389ef (patch) | |
tree | 9dbe901d30f7d0f44f80e4c6c42fc3c83e17d108 /chrome | |
parent | 3ac14a058599a1381224264784ad4000934f0119 (diff) | |
download | chromium_src-fa83e761550a9ef5f33be95238da1d12e75389ef.zip chromium_src-fa83e761550a9ef5f33be95238da1d12e75389ef.tar.gz chromium_src-fa83e761550a9ef5f33be95238da1d12e75389ef.tar.bz2 |
Fix build break.
TBR=joshia
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@965 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/automation/automation_provider.cc | 33 | ||||
-rw-r--r-- | chrome/browser/render_view_host.h | 4 |
2 files changed, 37 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index e580aa3..1bae14d 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -44,6 +44,7 @@ #include "chrome/browser/login_prompt.h" #include "chrome/browser/navigation_entry.h" #include "chrome/browser/printing/print_job.h" +#include "chrome/browser/render_view_host.h" #include "chrome/browser/save_package.h" #include "chrome/browser/ssl_blocking_page.h" #include "chrome/browser/web_contents.h" @@ -766,6 +767,8 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { GetConstrainedWindowBounds) IPC_MESSAGE_HANDLER(AutomationMsg_OpenFindInPageRequest, HandleOpenFindInPageRequest) + IPC_MESSAGE_HANDLER(AutomationMsg_PostMessage, + OnPostMessage) IPC_END_MESSAGE_MAP() } @@ -2197,6 +2200,36 @@ void AutomationProvider::AutocompleteEditIsQueryInProgress( message.routing_id(), success, query_in_progress)); } +void AutomationProvider::OnPostMessage(int handle, + const std::string& target, + const std::string& message) { + if (tab_tracker_->ContainsHandle(handle)) { + NavigationController* tab = tab_tracker_->GetResource(handle); + if (!tab) { + NOTREACHED(); + return; + } + TabContents* tab_contents = tab->GetTabContents(TAB_CONTENTS_WEB); + if (!tab_contents) { + NOTREACHED(); + return; + } + + WebContents* web_contents = tab_contents->AsWebContents(); + if (!web_contents) { + NOTREACHED(); + return; + } + + RenderViewHost* view_host = web_contents->render_view_host(); + if (!view_host) { + return; + } + + view_host->PostMessage(target, message); + } +} + TestingAutomationProvider::TestingAutomationProvider(Profile* profile) : AutomationProvider(profile) { BrowserList::AddObserver(this); diff --git a/chrome/browser/render_view_host.h b/chrome/browser/render_view_host.h index 2faf76a..7b9f593 100644 --- a/chrome/browser/render_view_host.h +++ b/chrome/browser/render_view_host.h @@ -398,6 +398,10 @@ 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); + #ifdef CHROME_PERSONALIZATION HostPersonalization personalization() { return personalization_; |