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