| 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 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 bool ChromeContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { | 1533 bool ChromeContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { |
| 1534 #if defined(ENABLE_PLUGINS) | 1534 #if defined(ENABLE_PLUGINS) |
| 1535 // Allow access for tests. | 1535 // Allow access for tests. |
| 1536 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1536 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1537 switches::kEnablePepperTesting)) { | 1537 switches::kEnablePepperTesting)) { |
| 1538 return true; | 1538 return true; |
| 1539 } | 1539 } |
| 1540 | 1540 |
| 1541 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 1541 version_info::Channel channel = chrome::VersionInfo::GetChannel(); |
| 1542 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" | 1542 // Allow dev channel APIs to be used on "Canary", "Dev", and "Unknown" |
| 1543 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 1543 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
| 1544 // Chromium builds as well. | 1544 // Chromium builds as well. |
| 1545 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 1545 return channel <= version_info::CHANNEL_DEV; |
| 1546 #else | 1546 #else |
| 1547 return false; | 1547 return false; |
| 1548 #endif | 1548 #endif |
| 1549 } | 1549 } |
| 1550 | 1550 |
| 1551 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI( | 1551 bool ChromeContentRendererClient::IsPluginAllowedToUseCameraDeviceAPI( |
| 1552 const GURL& url) { | 1552 const GURL& url) { |
| 1553 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) | 1553 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
| 1554 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1554 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1555 switches::kEnablePepperTesting)) | 1555 switches::kEnablePepperTesting)) |
| 1556 return true; | 1556 return true; |
| 1557 | 1557 |
| 1558 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_camera_device_origins_)) | 1558 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_camera_device_origins_)) |
| 1559 return true; | 1559 return true; |
| 1560 #endif | 1560 #endif |
| 1561 | 1561 |
| 1562 return false; | 1562 return false; |
| 1563 } | 1563 } |
| 1564 | 1564 |
| 1565 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( | 1565 bool ChromeContentRendererClient::IsPluginAllowedToUseCompositorAPI( |
| 1566 const GURL& url) { | 1566 const GURL& url) { |
| 1567 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) | 1567 #if defined(ENABLE_PLUGINS) && defined(ENABLE_EXTENSIONS) |
| 1568 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1568 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1569 switches::kEnablePepperTesting)) | 1569 switches::kEnablePepperTesting)) |
| 1570 return true; | 1570 return true; |
| 1571 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) | 1571 if (IsExtensionOrSharedModuleWhitelisted(url, allowed_compositor_origins_)) |
| 1572 return true; | 1572 return true; |
| 1573 | 1573 |
| 1574 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 1574 version_info::Channel channel = chrome::VersionInfo::GetChannel(); |
| 1575 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 1575 return channel <= version_info::CHANNEL_DEV; |
| 1576 #else | 1576 #else |
| 1577 return false; | 1577 return false; |
| 1578 #endif | 1578 #endif |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 content::BrowserPluginDelegate* | 1581 content::BrowserPluginDelegate* |
| 1582 ChromeContentRendererClient::CreateBrowserPluginDelegate( | 1582 ChromeContentRendererClient::CreateBrowserPluginDelegate( |
| 1583 content::RenderFrame* render_frame, | 1583 content::RenderFrame* render_frame, |
| 1584 const std::string& mime_type, | 1584 const std::string& mime_type, |
| 1585 const GURL& original_url) { | 1585 const GURL& original_url) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1619 WebString header_key(ASCIIToUTF16( | 1619 WebString header_key(ASCIIToUTF16( |
| 1620 data_reduction_proxy::chrome_proxy_header())); | 1620 data_reduction_proxy::chrome_proxy_header())); |
| 1621 if (!response.httpHeaderField(header_key).isNull() && | 1621 if (!response.httpHeaderField(header_key).isNull() && |
| 1622 response.httpHeaderField(header_key).utf8().find( | 1622 response.httpHeaderField(header_key).utf8().find( |
| 1623 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != | 1623 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != |
| 1624 std::string::npos) { | 1624 std::string::npos) { |
| 1625 (*properties)[data_reduction_proxy::chrome_proxy_header()] = | 1625 (*properties)[data_reduction_proxy::chrome_proxy_header()] = |
| 1626 data_reduction_proxy::chrome_proxy_lo_fi_directive(); | 1626 data_reduction_proxy::chrome_proxy_lo_fi_directive(); |
| 1627 } | 1627 } |
| 1628 } | 1628 } |
| OLD | NEW |