Chromium Code Reviews| Index: content/browser/frame_host/interstitial_page_impl.cc |
| diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc |
| index 41470a421e55ecf31507396cc318b61e01f48516..af32c0dc69ca4c6fb6f62a132be40d1b1ea2569c 100644 |
| --- a/content/browser/frame_host/interstitial_page_impl.cc |
| +++ b/content/browser/frame_host/interstitial_page_impl.cc |
| @@ -37,6 +37,7 @@ |
| #include "content/public/browser/notification_service.h" |
| #include "content/public/browser/notification_source.h" |
| #include "content/public/browser/storage_partition.h" |
| +#include "content/public/browser/user_metrics.h" |
| #include "content/public/browser/web_contents_delegate.h" |
| #include "content/public/common/bindings_policy.h" |
| #include "content/public/common/page_transition_types.h" |
| @@ -249,9 +250,6 @@ void InterstitialPageImpl::Show() { |
| notification_registrar_.Add(this, NOTIFICATION_NAV_ENTRY_PENDING, |
| Source<NavigationController>(controller_)); |
| - notification_registrar_.Add( |
| - this, NOTIFICATION_DOM_OPERATION_RESPONSE, |
| - Source<RenderViewHost>(render_view_host_)); |
| } |
| void InterstitialPageImpl::Hide() { |
| @@ -346,13 +344,6 @@ void InterstitialPageImpl::Observe( |
| TakeActionOnResourceDispatcher(CANCEL); |
| } |
| break; |
| - case NOTIFICATION_DOM_OPERATION_RESPONSE: |
| - if (enabled()) { |
| - Details<DomOperationNotificationDetails> dom_op_details( |
| - details); |
| - delegate_->CommandReceived(dom_op_details->json); |
| - } |
| - break; |
| default: |
| NOTREACHED(); |
| } |
| @@ -367,6 +358,34 @@ void InterstitialPageImpl::WebContentsDestroyed(WebContents* web_contents) { |
| OnNavigatingAwayOrTabClosing(); |
| } |
| +bool InterstitialPageImpl::OnMessageReceived(RenderFrameHost* render_frame_host, |
| + const IPC::Message& message) { |
| + return OnMessageReceived(message); |
| +} |
| + |
| +bool InterstitialPageImpl::OnMessageReceived(RenderViewHost* render_view_host, |
|
Charlie Reis
2014/02/18 18:06:15
This isn't used for anything, is it? Maybe it's b
mkosiba (inactive)
2014/02/18 19:10:04
This is the only sane-looking way I found to work
Charlie Reis
2014/02/18 19:38:55
Ah, fun. I don't have a better idea for that, so
|
| + const IPC::Message& message) { |
| + return OnMessageReceived(message); |
| +} |
| + |
| +bool InterstitialPageImpl::OnMessageReceived(const IPC::Message& message) { |
| + |
| + bool handled = true; |
| + bool message_is_ok = true; |
| + IPC_BEGIN_MESSAGE_MAP_EX(InterstitialPageImpl, message, message_is_ok) |
| + IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse, |
| + OnDomOperationResponse) |
| + IPC_MESSAGE_UNHANDLED(handled = false) |
| + IPC_END_MESSAGE_MAP_EX() |
| + |
| + if (!message_is_ok) { |
| + RecordAction(base::UserMetricsAction("BadMessageTerminate_RVD")); |
| + web_contents()->GetRenderProcessHost()->ReceivedBadMessage(); |
| + } |
| + |
| + return handled; |
| +} |
| + |
| void InterstitialPageImpl::RenderFrameCreated( |
| RenderFrameHost* render_frame_host) { |
| // Note this is only for subframes in the interstitial, the notification for |
| @@ -806,6 +825,22 @@ void InterstitialPageImpl::TakeActionOnResourceDispatcher( |
| action)); |
| } |
| +void InterstitialPageImpl::OnDomOperationResponse( |
| + const std::string& json_string, |
| + int automation_id) { |
| + // Needed by test code. |
| + DomOperationNotificationDetails details(json_string, automation_id); |
| + NotificationService::current()->Notify( |
| + NOTIFICATION_DOM_OPERATION_RESPONSE, |
| + Source<WebContents>(web_contents()), |
| + Details<DomOperationNotificationDetails>(&details)); |
| + |
| + if (!enabled()) |
| + return; |
| + delegate_->CommandReceived(details.json); |
| +} |
| + |
| + |
| InterstitialPageImpl::InterstitialPageRVHDelegateView:: |
| InterstitialPageRVHDelegateView(InterstitialPageImpl* page) |
| : interstitial_page_(page) { |