Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 731 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, | 731 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, |
| 732 OnRegisterProtocolHandler) | 732 OnRegisterProtocolHandler) |
| 733 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, | 733 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, |
| 734 OnUnregisterProtocolHandler) | 734 OnUnregisterProtocolHandler) |
| 735 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, | 735 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals, |
| 736 OnUpdatePageImportanceSignals) | 736 OnUpdatePageImportanceSignals) |
| 737 IPC_MESSAGE_HANDLER(FrameHostMsg_Find_Reply, OnFindReply) | 737 IPC_MESSAGE_HANDLER(FrameHostMsg_Find_Reply, OnFindReply) |
| 738 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 738 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
| 739 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 739 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
| 740 #if BUILDFLAG(ENABLE_PLUGINS) | 740 #if BUILDFLAG(ENABLE_PLUGINS) |
| 741 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceCreated, | |
| 742 OnPepperInstanceCreated) | |
| 743 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceDeleted, | |
| 744 OnPepperInstanceDeleted) | |
| 745 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) | 741 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) |
| 746 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStartsPlayback, | |
| 747 OnPepperStartsPlayback) | |
| 748 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStopsPlayback, | |
| 749 OnPepperStopsPlayback) | |
| 750 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) | 742 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) |
| 751 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, | 743 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, |
| 752 OnRequestPpapiBrokerPermission) | 744 OnRequestPpapiBrokerPermission) |
| 753 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_Attach, | 745 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_Attach, |
| 754 OnBrowserPluginMessage(render_frame_host, | 746 OnBrowserPluginMessage(render_frame_host, |
| 755 message)) | 747 message)) |
| 756 #endif | 748 #endif |
| 757 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) | 749 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL) |
| 758 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, | 750 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage, |
| 759 OnShowValidationMessage) | 751 OnShowValidationMessage) |
| 760 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, | 752 IPC_MESSAGE_HANDLER(ViewHostMsg_HideValidationMessage, |
| 761 OnHideValidationMessage) | 753 OnHideValidationMessage) |
| 762 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, | 754 IPC_MESSAGE_HANDLER(ViewHostMsg_MoveValidationMessage, |
| 763 OnMoveValidationMessage) | 755 OnMoveValidationMessage) |
| 764 #if defined(OS_ANDROID) | 756 #if defined(OS_ANDROID) |
| 765 IPC_MESSAGE_HANDLER(FrameHostMsg_FindMatchRects_Reply, | 757 IPC_MESSAGE_HANDLER(FrameHostMsg_FindMatchRects_Reply, |
| 766 OnFindMatchRectsReply) | 758 OnFindMatchRectsReply) |
| 767 IPC_MESSAGE_HANDLER(FrameHostMsg_GetNearestFindResult_Reply, | 759 IPC_MESSAGE_HANDLER(FrameHostMsg_GetNearestFindResult_Reply, |
| 768 OnGetNearestFindResultReply) | 760 OnGetNearestFindResultReply) |
| 769 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, | 761 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenDateTimeDialog, |
| 770 OnOpenDateTimeDialog) | 762 OnOpenDateTimeDialog) |
| 771 #endif | 763 #endif |
| 772 IPC_MESSAGE_UNHANDLED(handled = false) | 764 IPC_MESSAGE_UNHANDLED(handled = false) |
| 773 IPC_END_MESSAGE_MAP() | 765 IPC_END_MESSAGE_MAP() |
| 766 | |
| 767 #if BUILDFLAG(ENABLE_PLUGINS) | |
| 768 if (render_frame_host && !handled) { | |
| 769 handled = true; | |
| 770 // Maps for messages that need to be handled with |render_frame_host| as a | |
| 771 // parameter | |
| 772 IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(WebContentsImpl, message, | |
|
whywhat
2016/12/06 01:37:31
nit: change WebContentsImpl to RenderFrameHostImpl
Zhiqiang Zhang (Slow)
2016/12/06 12:05:56
No longer applicable, this change is reverted.
| |
| 773 render_frame_host) | |
| 774 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceCreated, | |
| 775 OnPepperInstanceCreated) | |
| 776 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceDeleted, | |
| 777 OnPepperInstanceDeleted) | |
| 778 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStartsPlayback, | |
| 779 OnPepperStartsPlayback) | |
| 780 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperStopsPlayback, | |
| 781 OnPepperStopsPlayback) | |
| 782 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 783 IPC_END_MESSAGE_MAP() | |
| 784 } | |
| 785 #endif // BUILDFLAG(ENABLE_PLUGINS) | |
| 786 | |
| 774 render_view_message_source_ = NULL; | 787 render_view_message_source_ = NULL; |
| 775 render_frame_message_source_ = NULL; | 788 render_frame_message_source_ = NULL; |
| 776 | 789 |
| 777 return handled; | 790 return handled; |
| 778 } | 791 } |
| 779 | 792 |
| 780 bool WebContentsImpl::HasValidFrameSource() { | 793 bool WebContentsImpl::HasValidFrameSource() { |
| 781 if (!render_frame_message_source_) { | 794 if (!render_frame_message_source_) { |
| 782 DCHECK(render_view_message_source_); | 795 DCHECK(render_view_message_source_); |
| 783 bad_message::ReceivedBadMessage(GetRenderProcessHost(), | 796 bad_message::ReceivedBadMessage(GetRenderProcessHost(), |
| (...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3750 // This exists for render views that don't have a WebUI, but do have WebUI | 3763 // This exists for render views that don't have a WebUI, but do have WebUI |
| 3751 // bindings enabled. | 3764 // bindings enabled. |
| 3752 void WebContentsImpl::OnWebUISend(const GURL& source_url, | 3765 void WebContentsImpl::OnWebUISend(const GURL& source_url, |
| 3753 const std::string& name, | 3766 const std::string& name, |
| 3754 const base::ListValue& args) { | 3767 const base::ListValue& args) { |
| 3755 if (delegate_) | 3768 if (delegate_) |
| 3756 delegate_->WebUISend(this, source_url, name, args); | 3769 delegate_->WebUISend(this, source_url, name, args); |
| 3757 } | 3770 } |
| 3758 | 3771 |
| 3759 #if BUILDFLAG(ENABLE_PLUGINS) | 3772 #if BUILDFLAG(ENABLE_PLUGINS) |
| 3760 void WebContentsImpl::OnPepperInstanceCreated(int32_t pp_instance) { | 3773 void WebContentsImpl::OnPepperInstanceCreated( |
| 3774 RenderFrameHost* render_frame_host, int32_t pp_instance) { | |
| 3761 for (auto& observer : observers_) | 3775 for (auto& observer : observers_) |
| 3762 observer.PepperInstanceCreated(); | 3776 observer.PepperInstanceCreated(); |
| 3763 pepper_playback_observer_->PepperInstanceCreated(pp_instance); | 3777 pepper_playback_observer_->PepperInstanceCreated( |
| 3778 render_frame_host, pp_instance); | |
|
whywhat
2016/12/06 01:37:31
Hm, it seems like you don't need to change the map
Zhiqiang Zhang (Slow)
2016/12/06 12:05:56
Didn't realize that. Thanks for pointing out. Done
| |
| 3764 } | 3779 } |
| 3765 | 3780 |
| 3766 void WebContentsImpl::OnPepperInstanceDeleted(int32_t pp_instance) { | 3781 void WebContentsImpl::OnPepperInstanceDeleted( |
| 3782 RenderFrameHost* render_frame_host, int32_t pp_instance) { | |
| 3767 for (auto& observer : observers_) | 3783 for (auto& observer : observers_) |
| 3768 observer.PepperInstanceDeleted(); | 3784 observer.PepperInstanceDeleted(); |
| 3769 pepper_playback_observer_->PepperInstanceDeleted(pp_instance); | 3785 pepper_playback_observer_->PepperInstanceDeleted( |
| 3786 render_frame_host, pp_instance); | |
| 3770 } | 3787 } |
| 3771 | 3788 |
| 3772 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, | 3789 void WebContentsImpl::OnPepperPluginHung(int plugin_child_id, |
| 3773 const base::FilePath& path, | 3790 const base::FilePath& path, |
| 3774 bool is_hung) { | 3791 bool is_hung) { |
| 3775 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); | 3792 UMA_HISTOGRAM_COUNTS("Pepper.PluginHung", 1); |
| 3776 | 3793 |
| 3777 for (auto& observer : observers_) | 3794 for (auto& observer : observers_) |
| 3778 observer.PluginHungStatusChanged(plugin_child_id, path, is_hung); | 3795 observer.PluginHungStatusChanged(plugin_child_id, path, is_hung); |
| 3779 } | 3796 } |
| 3780 | 3797 |
| 3781 void WebContentsImpl::OnPepperStartsPlayback(int32_t pp_instance) { | 3798 void WebContentsImpl::OnPepperStartsPlayback( |
| 3782 pepper_playback_observer_->PepperStartsPlayback(pp_instance); | 3799 RenderFrameHost* render_frame_host, int32_t pp_instance) { |
| 3800 pepper_playback_observer_->PepperStartsPlayback( | |
| 3801 render_frame_host, pp_instance); | |
| 3783 } | 3802 } |
| 3784 | 3803 |
| 3785 void WebContentsImpl::OnPepperStopsPlayback(int32_t pp_instance) { | 3804 void WebContentsImpl::OnPepperStopsPlayback( |
| 3786 pepper_playback_observer_->PepperStopsPlayback(pp_instance); | 3805 RenderFrameHost* render_frame_host, int32_t pp_instance) { |
| 3806 pepper_playback_observer_->PepperStopsPlayback( | |
| 3807 render_frame_host, pp_instance); | |
| 3787 } | 3808 } |
| 3788 | 3809 |
| 3789 void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path, | 3810 void WebContentsImpl::OnPluginCrashed(const base::FilePath& plugin_path, |
| 3790 base::ProcessId plugin_pid) { | 3811 base::ProcessId plugin_pid) { |
| 3791 for (auto& observer : observers_) | 3812 for (auto& observer : observers_) |
| 3792 observer.PluginCrashed(plugin_path, plugin_pid); | 3813 observer.PluginCrashed(plugin_path, plugin_pid); |
| 3793 } | 3814 } |
| 3794 | 3815 |
| 3795 void WebContentsImpl::OnRequestPpapiBrokerPermission( | 3816 void WebContentsImpl::OnRequestPpapiBrokerPermission( |
| 3796 int routing_id, | 3817 int routing_id, |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5280 dialog_manager_ = dialog_manager; | 5301 dialog_manager_ = dialog_manager; |
| 5281 } | 5302 } |
| 5282 | 5303 |
| 5283 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { | 5304 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { |
| 5284 auto it = binding_sets_.find(interface_name); | 5305 auto it = binding_sets_.find(interface_name); |
| 5285 if (it != binding_sets_.end()) | 5306 if (it != binding_sets_.end()) |
| 5286 binding_sets_.erase(it); | 5307 binding_sets_.erase(it); |
| 5287 } | 5308 } |
| 5288 | 5309 |
| 5289 } // namespace content | 5310 } // namespace content |
| OLD | NEW |