diff options
author | ericcheng@google.com <ericcheng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-26 01:27:35 +0000 |
---|---|---|
committer | ericcheng@google.com <ericcheng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-26 01:27:35 +0000 |
commit | 1cc87964e944939380107ed86107868344adb304 (patch) | |
tree | 0ea2ec036516062e51da919edb3af0604f6e2a3f /chrome | |
parent | f3bb0346579cd4eb431c45e43041e139876015e8 (diff) | |
download | chromium_src-1cc87964e944939380107ed86107868344adb304.zip chromium_src-1cc87964e944939380107ed86107868344adb304.tar.gz chromium_src-1cc87964e944939380107ed86107868344adb304.tar.bz2 |
Some more glue code for the personalization module.
Added ability to invoke a method on an NPObject wrapped in
a CppVariant.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/render_view_host.cc | 9 | ||||
-rw-r--r-- | chrome/browser/render_view_host.h | 4 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 6 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 13 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 4 |
5 files changed, 34 insertions, 2 deletions
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc index 9385b0a..56fc23d 100644 --- a/chrome/browser/render_view_host.cc +++ b/chrome/browser/render_view_host.cc @@ -1003,7 +1003,7 @@ void RenderViewHost::OnMsgForwardMessageToExternalHost( #ifdef CHROME_PERSONALIZATION void RenderViewHost::OnPersonalizationEvent(const std::string& message, - const std::string& content) { + const std::string& content) { Personalization::HandlePersonalizationEvent(this, message, content); } #endif @@ -1200,6 +1200,13 @@ void RenderViewHost::OnDebugDisconnect() { } } +void RenderViewHost::RaiseAvatarEvent(std::string event_name, + std::string event_arg) { + Send(new ViewMsg_PersonalizationEvent(routing_id_, + event_name, + event_arg)); +} + 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 373113a..e81c0dc 100644 --- a/chrome/browser/render_view_host.h +++ b/chrome/browser/render_view_host.h @@ -377,6 +377,10 @@ class RenderViewHost : public RenderWidgetHost { // and we're necessarily leaving the page. void UnloadListenerHasFired() { has_unload_listener_ = false; } + // Tells the RenderView to raise an avatar event with the given name and + // argument. + void RaiseAvatarEvent(std::string event_name, std::string event_arg); + // Forward a message from external host to chrome renderer. void ForwardMessageFromExternalHost(const std::string& target, const std::string& message); diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 36077f5..812978e 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -413,6 +413,10 @@ IPC_BEGIN_MESSAGES(View, 1) IPC_MESSAGE_ROUTED1(ViewMsg_Repaint, gfx::Size /* The view size to be repainted */) + IPC_MESSAGE_ROUTED2(ViewMsg_PersonalizationEvent, + std::string /* event name */, + std::string /* event arguments */) + // Posts a message to the renderer. IPC_MESSAGE_ROUTED2(ViewMsg_HandleMessageFromExternalHost, std::string /* The target for the message */, @@ -716,7 +720,7 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) #ifdef CHROME_PERSONALIZATION IPC_MESSAGE_ROUTED2(ViewHostMsg_PersonalizationEvent, - std::string, std::string ) + std::string, std::string) #endif // A renderer sends this to the browser process when it wants to create a diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index ac008c1..0f88427 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -333,6 +333,7 @@ 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_PersonalizationEvent, OnPersonalizationEvent) IPC_MESSAGE_HANDLER(ViewMsg_HandleMessageFromExternalHost, OnMessageFromExternalHost) // Have the super handle all other messages. @@ -2480,6 +2481,18 @@ void RenderView::OnThemeChanged() { DidInvalidateRect(webwidget_, view_rect); } +void RenderView::OnPersonalizationEvent(std::string event_name, + std::string event_args) { + Personalization::HandleViewMsgPersonalizationEvent(personalization_, + webview(), + event_name, + event_args); +} + +void RenderView::TransitionToCommittedForNewPage() { + Personalization::HandleTransitionToCommittedForNewPage(personalization_); +} + void RenderView::OnMessageFromExternalHost( const std::string& target, const std::string& message) { if (message.empty()) diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index f74e42f..746a49f 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -431,6 +431,8 @@ class RenderView : public RenderWidget, public WebViewDelegate, // Notification about ui theme changes. void OnThemeChanged(); + void OnPersonalizationEvent(std::string event_name, std::string event_args); + // Handles messages posted from automation. void OnMessageFromExternalHost(const std::string& target, const std::string& message); @@ -475,6 +477,8 @@ class RenderView : public RenderWidget, public WebViewDelegate, std::string GetAltHTMLForTemplate(const DictionaryValue& error_strings, int template_resource_id) const; + virtual void TransitionToCommittedForNewPage(); + // A helper method used by WasOpenedByUserGesture. bool WasOpenedByUserGestureHelper() const; |