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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 OnRegisterProtocolHandler) | 679 OnRegisterProtocolHandler) |
680 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 680 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
681 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) | 681 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) |
682 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 682 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
683 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) | 683 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) |
684 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) | 684 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) |
685 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, | 685 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, |
686 OnSetSelectedColorInColorChooser) | 686 OnSetSelectedColorInColorChooser) |
687 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) | 687 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) |
688 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 688 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
| 689 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, |
| 690 OnRequestPpapiBrokerPermission) |
689 IPC_MESSAGE_UNHANDLED(handled = false) | 691 IPC_MESSAGE_UNHANDLED(handled = false) |
690 IPC_END_MESSAGE_MAP_EX() | 692 IPC_END_MESSAGE_MAP_EX() |
691 message_source_ = NULL; | 693 message_source_ = NULL; |
692 | 694 |
693 if (!message_is_ok) { | 695 if (!message_is_ok) { |
694 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 696 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
695 GetRenderProcessHost()->ReceivedBadMessage(); | 697 GetRenderProcessHost()->ReceivedBadMessage(); |
696 } | 698 } |
697 | 699 |
698 return handled; | 700 return handled; |
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 | 2173 |
2172 // This exists for render views that don't have a WebUI, but do have WebUI | 2174 // This exists for render views that don't have a WebUI, but do have WebUI |
2173 // bindings enabled. | 2175 // bindings enabled. |
2174 void WebContentsImpl::OnWebUISend(const GURL& source_url, | 2176 void WebContentsImpl::OnWebUISend(const GURL& source_url, |
2175 const std::string& name, | 2177 const std::string& name, |
2176 const base::ListValue& args) { | 2178 const base::ListValue& args) { |
2177 if (delegate_) | 2179 if (delegate_) |
2178 delegate_->WebUISend(this, source_url, name, args); | 2180 delegate_->WebUISend(this, source_url, name, args); |
2179 } | 2181 } |
2180 | 2182 |
| 2183 void WebContentsImpl::OnRequestPpapiBrokerPermission( |
| 2184 int request_id, |
| 2185 const GURL& url, |
| 2186 const FilePath& plugin_path) { |
| 2187 if (!delegate_) { |
| 2188 OnPpapiBrokerPermissionResult(request_id, false); |
| 2189 return; |
| 2190 } |
| 2191 |
| 2192 delegate_->RequestPpapiBrokerPermission( |
| 2193 this, url, plugin_path, |
| 2194 base::Bind(&WebContentsImpl::OnPpapiBrokerPermissionResult, |
| 2195 base::Unretained(this), request_id)); |
| 2196 } |
| 2197 |
| 2198 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, |
| 2199 bool result) { |
| 2200 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); |
| 2201 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), |
| 2202 request_id, |
| 2203 result)); |
| 2204 } |
| 2205 |
2181 // Notifies the RenderWidgetHost instance about the fact that the page is | 2206 // Notifies the RenderWidgetHost instance about the fact that the page is |
2182 // loading, or done loading and calls the base implementation. | 2207 // loading, or done loading and calls the base implementation. |
2183 void WebContentsImpl::SetIsLoading(bool is_loading, | 2208 void WebContentsImpl::SetIsLoading(bool is_loading, |
2184 LoadNotificationDetails* details) { | 2209 LoadNotificationDetails* details) { |
2185 if (is_loading == is_loading_) | 2210 if (is_loading == is_loading_) |
2186 return; | 2211 return; |
2187 | 2212 |
2188 if (!is_loading) { | 2213 if (!is_loading) { |
2189 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16()); | 2214 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16()); |
2190 load_state_host_.clear(); | 2215 load_state_host_.clear(); |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3141 old_browser_plugin_host()->embedder_render_process_host(); | 3166 old_browser_plugin_host()->embedder_render_process_host(); |
3142 *embedder_container_id = old_browser_plugin_host()->instance_id(); | 3167 *embedder_container_id = old_browser_plugin_host()->instance_id(); |
3143 int embedder_process_id = | 3168 int embedder_process_id = |
3144 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; | 3169 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; |
3145 if (embedder_process_id != -1) { | 3170 if (embedder_process_id != -1) { |
3146 *embedder_channel_name = | 3171 *embedder_channel_name = |
3147 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), | 3172 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), |
3148 embedder_process_id); | 3173 embedder_process_id); |
3149 } | 3174 } |
3150 } | 3175 } |
OLD | NEW |