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