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/renderer/pepper/content_renderer_pepper_host_factory.h" | 5 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "content/public/common/content_client.h" | 9 #include "content/public/common/content_client.h" |
10 #include "content/public/renderer/content_renderer_client.h" | 10 #include "content/public/renderer/content_renderer_client.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "third_party/WebKit/public/platform/WebURL.h" | 32 #include "third_party/WebKit/public/platform/WebURL.h" |
33 #include "third_party/WebKit/public/web/WebDocument.h" | 33 #include "third_party/WebKit/public/web/WebDocument.h" |
34 #include "third_party/WebKit/public/web/WebElement.h" | 34 #include "third_party/WebKit/public/web/WebElement.h" |
35 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 35 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
36 | 36 |
37 using ppapi::host::ResourceHost; | 37 using ppapi::host::ResourceHost; |
38 using ppapi::UnpackMessage; | 38 using ppapi::UnpackMessage; |
39 | 39 |
40 namespace content { | 40 namespace content { |
41 | 41 |
42 #if defined(ENABLE_WEBRTC) | |
43 namespace { | 42 namespace { |
44 | 43 |
| 44 #if defined(ENABLE_WEBRTC) |
45 bool CanUseMediaStreamAPI(const RendererPpapiHost* host, PP_Instance instance) { | 45 bool CanUseMediaStreamAPI(const RendererPpapiHost* host, PP_Instance instance) { |
46 blink::WebPluginContainer* container = | 46 blink::WebPluginContainer* container = |
47 host->GetContainerForInstance(instance); | 47 host->GetContainerForInstance(instance); |
48 if (!container) | 48 if (!container) |
49 return false; | 49 return false; |
50 | 50 |
51 GURL document_url = container->element().document().url(); | 51 GURL document_url = container->element().document().url(); |
52 ContentRendererClient* content_renderer_client = | 52 ContentRendererClient* content_renderer_client = |
53 GetContentClient()->renderer(); | 53 GetContentClient()->renderer(); |
54 return content_renderer_client->AllowPepperMediaStreamAPI(document_url); | 54 return content_renderer_client->AllowPepperMediaStreamAPI(document_url); |
55 } | 55 } |
| 56 #endif // defined(ENABLE_WEBRTC) |
56 | 57 |
57 bool CanUseCompositorAPI(const RendererPpapiHost* host, PP_Instance instance) { | 58 bool CanUseCompositorAPI(const RendererPpapiHost* host, PP_Instance instance) { |
58 blink::WebPluginContainer* container = | 59 blink::WebPluginContainer* container = |
59 host->GetContainerForInstance(instance); | 60 host->GetContainerForInstance(instance); |
60 if (!container) | 61 if (!container) |
61 return false; | 62 return false; |
62 | 63 |
63 GURL document_url = container->element().document().url(); | 64 GURL document_url = container->element().document().url(); |
64 ContentRendererClient* content_renderer_client = | 65 ContentRendererClient* content_renderer_client = |
65 GetContentClient()->renderer(); | 66 GetContentClient()->renderer(); |
66 return content_renderer_client->IsPluginAllowedToUseCompositorAPI( | 67 return content_renderer_client->IsPluginAllowedToUseCompositorAPI( |
67 document_url); | 68 document_url); |
68 } | 69 } |
69 | 70 |
70 bool CanUseVideoDecodeAPI(const RendererPpapiHost* host, PP_Instance instance) { | 71 bool CanUseVideoDecodeAPI(const RendererPpapiHost* host, PP_Instance instance) { |
71 blink::WebPluginContainer* container = | 72 blink::WebPluginContainer* container = |
72 host->GetContainerForInstance(instance); | 73 host->GetContainerForInstance(instance); |
73 if (!container) | 74 if (!container) |
74 return false; | 75 return false; |
75 | 76 |
76 GURL document_url = container->element().document().url(); | 77 GURL document_url = container->element().document().url(); |
77 ContentRendererClient* content_renderer_client = | 78 ContentRendererClient* content_renderer_client = |
78 GetContentClient()->renderer(); | 79 GetContentClient()->renderer(); |
79 return content_renderer_client->IsPluginAllowedToUseVideoDecodeAPI( | 80 return content_renderer_client->IsPluginAllowedToUseVideoDecodeAPI( |
80 document_url); | 81 document_url); |
81 } | 82 } |
82 | 83 |
83 } // namespace | 84 } // namespace |
84 #endif // defined(ENABLE_WEBRTC) | |
85 | 85 |
86 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( | 86 ContentRendererPepperHostFactory::ContentRendererPepperHostFactory( |
87 RendererPpapiHostImpl* host) | 87 RendererPpapiHostImpl* host) |
88 : host_(host) {} | 88 : host_(host) {} |
89 | 89 |
90 ContentRendererPepperHostFactory::~ContentRendererPepperHostFactory() {} | 90 ContentRendererPepperHostFactory::~ContentRendererPepperHostFactory() {} |
91 | 91 |
92 scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost( | 92 scoped_ptr<ResourceHost> ContentRendererPepperHostFactory::CreateResourceHost( |
93 ppapi::host::PpapiHost* host, | 93 ppapi::host::PpapiHost* host, |
94 const ppapi::proxy::ResourceMessageCallParams& params, | 94 const ppapi::proxy::ResourceMessageCallParams& params, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 return scoped_ptr<ResourceHost>(); | 206 return scoped_ptr<ResourceHost>(); |
207 } | 207 } |
208 | 208 |
209 const ppapi::PpapiPermissions& | 209 const ppapi::PpapiPermissions& |
210 ContentRendererPepperHostFactory::GetPermissions() const { | 210 ContentRendererPepperHostFactory::GetPermissions() const { |
211 return host_->GetPpapiHost()->permissions(); | 211 return host_->GetPpapiHost()->permissions(); |
212 } | 212 } |
213 | 213 |
214 } // namespace content | 214 } // namespace content |
OLD | NEW |