summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/render_view_host.cc9
-rw-r--r--chrome/browser/render_view_host.h4
-rw-r--r--chrome/common/render_messages_internal.h6
-rw-r--r--chrome/renderer/render_view.cc13
-rw-r--r--chrome/renderer/render_view.h4
-rw-r--r--webkit/glue/cpp_variant.cc14
-rw-r--r--webkit/glue/cpp_variant.h7
-rw-r--r--webkit/glue/webframeloaderclient_impl.cc8
-rw-r--r--webkit/glue/webview_delegate.h4
9 files changed, 67 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;
diff --git a/webkit/glue/cpp_variant.cc b/webkit/glue/cpp_variant.cc
index a33986d..efa90e7 100644
--- a/webkit/glue/cpp_variant.cc
+++ b/webkit/glue/cpp_variant.cc
@@ -250,3 +250,17 @@ std::vector<std::wstring> CppVariant::ToStringVector() const {
return wstring_vector;
}
+bool CppVariant::Invoke(const std::string& method, const CppVariant* args,
+ uint32 arg_count, CppVariant& result) const {
+ DCHECK(isObject());
+ NPIdentifier method_name = NPN_GetStringIdentifier(method.c_str());
+ NPObject* np_object = value.objectValue;
+ if (NPN_HasMethod(NULL, np_object, method_name)) {
+ NPVariant r;
+ bool status = NPN_Invoke(NULL, np_object, method_name, args, arg_count, &r);
+ result.Set(r);
+ return status;
+ } else {
+ return false;
+ }
+}
diff --git a/webkit/glue/cpp_variant.h b/webkit/glue/cpp_variant.h
index c1eb795..f8a4c2e 100644
--- a/webkit/glue/cpp_variant.h
+++ b/webkit/glue/cpp_variant.h
@@ -98,6 +98,13 @@ class CppVariant : public NPVariant {
// for converting a JavaScript array of strings into a vector of strings.
std::vector<std::wstring> ToStringVector() const;
+ // Invoke method of the given name on an object with the supplied arguments.
+ // The first argument should be the object on which the method is to be
+ // invoked. Returns whether the method was successfully invoked. If the
+ // method was invoked successfully, any return value is stored in the
+ // CppVariant specified by result.
+ bool Invoke(const std::string& method, const CppVariant* args,
+ uint32 arg_count, CppVariant& result) const;
};
#endif // WEBKIT_GLUE_CPP_VARIANT_H__
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc
index 4303598..7ba384a 100644
--- a/webkit/glue/webframeloaderclient_impl.cc
+++ b/webkit/glue/webframeloaderclient_impl.cc
@@ -1253,7 +1253,15 @@ void WebFrameLoaderClient::transitionToCommittedFromCachedPage(WebCore::CachedPa
ASSERT_NOT_REACHED();
}
+// Called when the FrameLoader goes into a state in which a new page load
+// will occur.
void WebFrameLoaderClient::transitionToCommittedForNewPage() {
+ WebViewImpl* webview = webframe_->webview_impl();
+ WebViewDelegate* d = webview->delegate();
+ // Notify the RenderView.
+ if (d) {
+ d->TransitionToCommittedForNewPage();
+ }
makeDocumentView();
}
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index 6e39316..1f313b3 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -709,6 +709,10 @@ class WebViewDelegate : virtual public WebWidgetDelegate {
virtual void WebInspectorOpened(int num_resources) { }
+ // Called when the FrameLoader goes into a state in which a new page load
+ // will occur.
+ virtual void TransitionToCommittedForNewPage() { }
+
WebViewDelegate() { }
virtual ~WebViewDelegate() { }