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 "chrome/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 using blink::WebURL; | 173 using blink::WebURL; |
174 using blink::WebURLError; | 174 using blink::WebURLError; |
175 using blink::WebURLRequest; | 175 using blink::WebURLRequest; |
176 using blink::WebURLResponse; | 176 using blink::WebURLResponse; |
177 using blink::WebVector; | 177 using blink::WebVector; |
178 | 178 |
179 namespace { | 179 namespace { |
180 | 180 |
181 ChromeContentRendererClient* g_current_client; | 181 ChromeContentRendererClient* g_current_client; |
182 | 182 |
| 183 // Whitelist PPAPI for Android Runtime for Chromium. (See crbug.com/383937) |
183 #if defined(ENABLE_PLUGINS) | 184 #if defined(ENABLE_PLUGINS) |
| 185 const char* const kPredefinedAllowedCameraDeviceOrigins[] = { |
| 186 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", |
| 187 "4EB74897CB187C7633357C2FE832E0AD6A44883A" |
| 188 }; |
| 189 |
184 const char* const kPredefinedAllowedCompositorOrigins[] = { | 190 const char* const kPredefinedAllowedCompositorOrigins[] = { |
185 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/383937 | 191 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", |
186 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/383937 | 192 "4EB74897CB187C7633357C2FE832E0AD6A44883A" |
187 }; | 193 }; |
188 #endif | 194 #endif |
189 | 195 |
190 void AppendParams(const std::vector<base::string16>& additional_names, | 196 void AppendParams(const std::vector<base::string16>& additional_names, |
191 const std::vector<base::string16>& additional_values, | 197 const std::vector<base::string16>& additional_values, |
192 WebVector<WebString>* existing_names, | 198 WebVector<WebString>* existing_names, |
193 WebVector<WebString>* existing_values) { | 199 WebVector<WebString>* existing_values) { |
194 DCHECK(additional_names.size() == additional_values.size()); | 200 DCHECK(additional_names.size() == additional_values.size()); |
195 DCHECK(existing_names->size() == existing_values->size()); | 201 DCHECK(existing_names->size() == existing_values->size()); |
196 | 202 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 ChromeContentRendererClient::ChromeContentRendererClient() { | 333 ChromeContentRendererClient::ChromeContentRendererClient() { |
328 g_current_client = this; | 334 g_current_client = this; |
329 | 335 |
330 #if defined(ENABLE_EXTENSIONS) | 336 #if defined(ENABLE_EXTENSIONS) |
331 extensions::ExtensionsClient::Set( | 337 extensions::ExtensionsClient::Set( |
332 extensions::ChromeExtensionsClient::GetInstance()); | 338 extensions::ChromeExtensionsClient::GetInstance()); |
333 extensions::ExtensionsRendererClient::Set( | 339 extensions::ExtensionsRendererClient::Set( |
334 ChromeExtensionsRendererClient::GetInstance()); | 340 ChromeExtensionsRendererClient::GetInstance()); |
335 #endif | 341 #endif |
336 #if defined(ENABLE_PLUGINS) | 342 #if defined(ENABLE_PLUGINS) |
| 343 for (size_t i = 0; i < arraysize(kPredefinedAllowedCameraDeviceOrigins); ++i) |
| 344 allowed_camera_device_origins_.insert( |
| 345 kPredefinedAllowedCameraDeviceOrigins[i]); |
337 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) | 346 for (size_t i = 0; i < arraysize(kPredefinedAllowedCompositorOrigins); ++i) |
338 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); | 347 allowed_compositor_origins_.insert(kPredefinedAllowedCompositorOrigins[i]); |
339 #endif | 348 #endif |
340 } | 349 } |
341 | 350 |
342 ChromeContentRendererClient::~ChromeContentRendererClient() { | 351 ChromeContentRendererClient::~ChromeContentRendererClient() { |
343 g_current_client = NULL; | 352 g_current_client = NULL; |
344 } | 353 } |
345 | 354 |
346 void ChromeContentRendererClient::RenderThreadStarted() { | 355 void ChromeContentRendererClient::RenderThreadStarted() { |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 1594 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
1586 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" | 1595 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" |
1587 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 1596 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
1588 // Chromium builds as well. | 1597 // Chromium builds as well. |
1589 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 1598 return channel <= chrome::VersionInfo::CHANNEL_DEV; |
1590 #else | 1599 #else |
1591 return false; | 1600 return false; |
1592 #endif | 1601 #endif |
1593 } | 1602 } |
1594 | 1603 |
| 1604 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI( |
| 1605 const GURL& url) { |
| 1606 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
| 1607 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1608 switches::kEnablePepperTesting)) |
| 1609 return true; |
| 1610 |
| 1611 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_camera_device_origins_)) |
| 1612 return true; |
| 1613 #endif |
| 1614 |
| 1615 return false; |
| 1616 } |
| 1617 |
1595 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( | 1618 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( |
1596 const GURL& url) { | 1619 const GURL& url) { |
1597 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) | 1620 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
1598 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1621 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1599 switches::kEnablePepperTesting)) | 1622 switches::kEnablePepperTesting)) |
1600 return true; | 1623 return true; |
1601 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) | 1624 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) |
1602 return true; | 1625 return true; |
1603 | 1626 |
1604 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 1627 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
(...skipping 12 matching lines...) Expand all Loading... |
1617 if (mime_type == content::kBrowserPluginMimeType) { | 1640 if (mime_type == content::kBrowserPluginMimeType) { |
1618 return new extensions::ExtensionsGuestViewContainer(render_frame); | 1641 return new extensions::ExtensionsGuestViewContainer(render_frame); |
1619 } else { | 1642 } else { |
1620 return new extensions::MimeHandlerViewContainer( | 1643 return new extensions::MimeHandlerViewContainer( |
1621 render_frame, mime_type, original_url); | 1644 render_frame, mime_type, original_url); |
1622 } | 1645 } |
1623 #else | 1646 #else |
1624 return NULL; | 1647 return NULL; |
1625 #endif | 1648 #endif |
1626 } | 1649 } |
OLD | NEW |