| 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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2299 const std::string& name, | 2299 const std::string& name, |
| 2300 const base::ListValue& args) { | 2300 const base::ListValue& args) { |
| 2301 if (delegate_) | 2301 if (delegate_) |
| 2302 delegate_->WebUISend(this, source_url, name, args); | 2302 delegate_->WebUISend(this, source_url, name, args); |
| 2303 } | 2303 } |
| 2304 | 2304 |
| 2305 void WebContentsImpl::OnRequestPpapiBrokerPermission( | 2305 void WebContentsImpl::OnRequestPpapiBrokerPermission( |
| 2306 int request_id, | 2306 int request_id, |
| 2307 const GURL& url, | 2307 const GURL& url, |
| 2308 const FilePath& plugin_path) { | 2308 const FilePath& plugin_path) { |
| 2309 base::Callback<void(bool)> callback = | 2309 if (!delegate_) { |
| 2310 base::Bind(&WebContentsImpl::OnPpapiBrokerPermissionResult, | 2310 OnPpapiBrokerPermissionResult(request_id, false); |
| 2311 base::Unretained(this), request_id); | 2311 return; |
| 2312 ObserverListBase<WebContentsObserver>::Iterator it(observers_); | |
| 2313 WebContentsObserver* observer; | |
| 2314 while ((observer = it.GetNext()) != NULL) { | |
| 2315 if (observer->RequestPpapiBrokerPermission(this, url, plugin_path, | |
| 2316 callback)) | |
| 2317 return; | |
| 2318 } | 2312 } |
| 2319 | 2313 |
| 2320 // Fall back to allowing the request if no observer handled it. | 2314 delegate_->RequestPpapiBrokerPermission( |
| 2321 OnPpapiBrokerPermissionResult(request_id, true); | 2315 this, url, plugin_path, |
| 2316 base::Bind(&WebContentsImpl::OnPpapiBrokerPermissionResult, |
| 2317 base::Unretained(this), request_id)); |
| 2322 } | 2318 } |
| 2323 | 2319 |
| 2324 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, | 2320 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, |
| 2325 bool result) { | 2321 bool result) { |
| 2326 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); | 2322 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); |
| 2327 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), | 2323 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), |
| 2328 request_id, | 2324 request_id, |
| 2329 result)); | 2325 result)); |
| 2330 } | 2326 } |
| 2331 | 2327 |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3337 | 3333 |
| 3338 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3334 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
| 3339 return browser_plugin_guest_.get(); | 3335 return browser_plugin_guest_.get(); |
| 3340 } | 3336 } |
| 3341 | 3337 |
| 3342 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3338 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
| 3343 return browser_plugin_embedder_.get(); | 3339 return browser_plugin_embedder_.get(); |
| 3344 } | 3340 } |
| 3345 | 3341 |
| 3346 } // namespace content | 3342 } // namespace content |
| OLD | NEW |