Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 10854040: Add hooks to content to request permission to connect to the PPAPI broker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: brett Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 OnRegisterProtocolHandler) 675 OnRegisterProtocolHandler)
676 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) 676 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply)
677 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) 677 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin)
678 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) 678 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
679 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser) 679 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser)
680 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser) 680 IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser)
681 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser, 681 IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser,
682 OnSetSelectedColorInColorChooser) 682 OnSetSelectedColorInColorChooser)
683 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung) 683 IPC_MESSAGE_HANDLER(ViewHostMsg_PepperPluginHung, OnPepperPluginHung)
684 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) 684 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
685 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission,
686 OnRequestPpapiBrokerPermission)
685 IPC_MESSAGE_UNHANDLED(handled = false) 687 IPC_MESSAGE_UNHANDLED(handled = false)
686 IPC_END_MESSAGE_MAP_EX() 688 IPC_END_MESSAGE_MAP_EX()
687 message_source_ = NULL; 689 message_source_ = NULL;
688 690
689 if (!message_is_ok) { 691 if (!message_is_ok) {
690 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); 692 content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD"));
691 GetRenderProcessHost()->ReceivedBadMessage(); 693 GetRenderProcessHost()->ReceivedBadMessage();
692 } 694 }
693 695
694 return handled; 696 return handled;
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 2244
2243 // This exists for render views that don't have a WebUI, but do have WebUI 2245 // This exists for render views that don't have a WebUI, but do have WebUI
2244 // bindings enabled. 2246 // bindings enabled.
2245 void WebContentsImpl::OnWebUISend(const GURL& source_url, 2247 void WebContentsImpl::OnWebUISend(const GURL& source_url,
2246 const std::string& name, 2248 const std::string& name,
2247 const base::ListValue& args) { 2249 const base::ListValue& args) {
2248 if (delegate_) 2250 if (delegate_)
2249 delegate_->WebUISend(this, source_url, name, args); 2251 delegate_->WebUISend(this, source_url, name, args);
2250 } 2252 }
2251 2253
2254 void WebContentsImpl::OnRequestPpapiBrokerPermission(
2255 int request_id,
2256 const GURL& url,
2257 const FilePath& plugin_path) {
2258 base::Callback<void(bool)> callback =
2259 base::Bind(&WebContentsImpl::OnPpapiBrokerPermissionResult,
2260 base::Unretained(this), request_id);
2261 ObserverListBase<WebContentsObserver>::Iterator it(observers_);
2262 WebContentsObserver* observer;
2263 while ((observer = it.GetNext()) != NULL) {
2264 if (observer->RequestPpapiBrokerPermission(this, url, plugin_path,
2265 callback))
2266 return;
2267 }
2268
2269 // Fall back to allowing the request if no observer handled it.
2270 OnPpapiBrokerPermissionResult(request_id, true);
2271 }
2272
2273 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id,
2274 bool result) {
2275 RenderViewHostImpl* rvh = GetRenderViewHostImpl();
2276 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(),
2277 request_id,
2278 result));
2279 }
2280
2252 // Notifies the RenderWidgetHost instance about the fact that the page is 2281 // Notifies the RenderWidgetHost instance about the fact that the page is
2253 // loading, or done loading and calls the base implementation. 2282 // loading, or done loading and calls the base implementation.
2254 void WebContentsImpl::SetIsLoading(bool is_loading, 2283 void WebContentsImpl::SetIsLoading(bool is_loading,
2255 LoadNotificationDetails* details) { 2284 LoadNotificationDetails* details) {
2256 if (is_loading == is_loading_) 2285 if (is_loading == is_loading_)
2257 return; 2286 return;
2258 2287
2259 if (!is_loading) { 2288 if (!is_loading) {
2260 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16()); 2289 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16());
2261 load_state_host_.clear(); 2290 load_state_host_.clear();
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 old_browser_plugin_host()->embedder_render_process_host(); 3240 old_browser_plugin_host()->embedder_render_process_host();
3212 *embedder_container_id = old_browser_plugin_host()->instance_id(); 3241 *embedder_container_id = old_browser_plugin_host()->instance_id();
3213 int embedder_process_id = 3242 int embedder_process_id =
3214 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; 3243 embedder_render_process_host ? embedder_render_process_host->GetID() : -1;
3215 if (embedder_process_id != -1) { 3244 if (embedder_process_id != -1) {
3216 *embedder_channel_name = 3245 *embedder_channel_name =
3217 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), 3246 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(),
3218 embedder_process_id); 3247 embedder_process_id);
3219 } 3248 }
3220 } 3249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698