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 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2309 const std::string& name, | 2309 const std::string& name, |
2310 const base::ListValue& args) { | 2310 const base::ListValue& args) { |
2311 if (delegate_) | 2311 if (delegate_) |
2312 delegate_->WebUISend(this, source_url, name, args); | 2312 delegate_->WebUISend(this, source_url, name, args); |
2313 } | 2313 } |
2314 | 2314 |
2315 void WebContentsImpl::OnRequestPpapiBrokerPermission( | 2315 void WebContentsImpl::OnRequestPpapiBrokerPermission( |
2316 int request_id, | 2316 int request_id, |
2317 const GURL& url, | 2317 const GURL& url, |
2318 const FilePath& plugin_path) { | 2318 const FilePath& plugin_path) { |
2319 base::Callback<void(bool)> callback = | 2319 if (!delegate_) { |
2320 base::Bind(&WebContentsImpl::OnPpapiBrokerPermissionResult, | 2320 OnPpapiBrokerPermissionResult(request_id, false); |
2321 base::Unretained(this), request_id); | 2321 return; |
2322 ObserverListBase<WebContentsObserver>::Iterator it(observers_); | |
2323 WebContentsObserver* observer; | |
2324 while ((observer = it.GetNext()) != NULL) { | |
2325 if (observer->RequestPpapiBrokerPermission(this, url, plugin_path, | |
2326 callback)) | |
2327 return; | |
2328 } | 2322 } |
2329 | 2323 |
2330 // Fall back to allowing the request if no observer handled it. | 2324 if (!delegate_->RequestPpapiBrokerPermission( |
2331 OnPpapiBrokerPermissionResult(request_id, true); | 2325 this, url, plugin_path, |
| 2326 base::Bind(&WebContentsImpl::OnPpapiBrokerPermissionResult, |
| 2327 base::Unretained(this), request_id))) { |
| 2328 NOTIMPLEMENTED(); |
| 2329 OnPpapiBrokerPermissionResult(request_id, false); |
| 2330 } |
2332 } | 2331 } |
2333 | 2332 |
2334 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, | 2333 void WebContentsImpl::OnPpapiBrokerPermissionResult(int request_id, |
2335 bool result) { | 2334 bool result) { |
2336 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); | 2335 RenderViewHostImpl* rvh = GetRenderViewHostImpl(); |
2337 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), | 2336 rvh->Send(new ViewMsg_PpapiBrokerPermissionResult(rvh->GetRoutingID(), |
2338 request_id, | 2337 request_id, |
2339 result)); | 2338 result)); |
2340 } | 2339 } |
2341 | 2340 |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3356 | 3355 |
3357 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3356 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
3358 return browser_plugin_guest_.get(); | 3357 return browser_plugin_guest_.get(); |
3359 } | 3358 } |
3360 | 3359 |
3361 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3360 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
3362 return browser_plugin_embedder_.get(); | 3361 return browser_plugin_embedder_.get(); |
3363 } | 3362 } |
3364 | 3363 |
3365 } // namespace content | 3364 } // namespace content |
OLD | NEW |