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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 } | 1474 } |
1475 | 1475 |
1476 bool ChromeContentRendererClient::AllowPepperMediaStreamAPI( | 1476 bool ChromeContentRendererClient::AllowPepperMediaStreamAPI( |
1477 const GURL& url) { | 1477 const GURL& url) { |
1478 #if !defined(OS_ANDROID) | 1478 #if !defined(OS_ANDROID) |
1479 // Allow only the Hangouts app to use the MediaStream APIs. It's OK to check | 1479 // Allow only the Hangouts app to use the MediaStream APIs. It's OK to check |
1480 // the whitelist in the renderer, since we're only preventing access until | 1480 // the whitelist in the renderer, since we're only preventing access until |
1481 // these APIs are public and stable. | 1481 // these APIs are public and stable. |
1482 std::string url_host = url.host(); | 1482 std::string url_host = url.host(); |
1483 if (url.SchemeIs("https") && | 1483 if (url.SchemeIs("https") && |
1484 (base::EndsWith(url_host, "talkgadget.google.com", false) || | 1484 (base::EndsWith(url_host, "talkgadget.google.com", |
1485 base::EndsWith(url_host, "plus.google.com", false) || | 1485 base::CompareCase::INSENSITIVE_ASCII) || |
1486 base::EndsWith(url_host, "plus.sandbox.google.com", false)) && | 1486 base::EndsWith(url_host, "plus.google.com", |
1487 base::StartsWithASCII(url.path(), "/hangouts/", false)) { | 1487 base::CompareCase::INSENSITIVE_ASCII) || |
| 1488 base::EndsWith(url_host, "plus.sandbox.google.com", |
| 1489 base::CompareCase::INSENSITIVE_ASCII)) && |
| 1490 base::StartsWith(url.path(), "/hangouts/", |
| 1491 base::CompareCase::INSENSITIVE_ASCII)) { |
1488 return true; | 1492 return true; |
1489 } | 1493 } |
1490 // Allow access for tests. | 1494 // Allow access for tests. |
1491 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 1495 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
1492 switches::kEnablePepperTesting)) { | 1496 switches::kEnablePepperTesting)) { |
1493 return true; | 1497 return true; |
1494 } | 1498 } |
1495 #endif // !defined(OS_ANDROID) | 1499 #endif // !defined(OS_ANDROID) |
1496 return false; | 1500 return false; |
1497 } | 1501 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 WebString header_key(ASCIIToUTF16( | 1624 WebString header_key(ASCIIToUTF16( |
1621 data_reduction_proxy::chrome_proxy_header())); | 1625 data_reduction_proxy::chrome_proxy_header())); |
1622 if (!response.httpHeaderField(header_key).isNull() && | 1626 if (!response.httpHeaderField(header_key).isNull() && |
1623 response.httpHeaderField(header_key).utf8().find( | 1627 response.httpHeaderField(header_key).utf8().find( |
1624 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != | 1628 data_reduction_proxy::chrome_proxy_lo_fi_directive()) != |
1625 std::string::npos) { | 1629 std::string::npos) { |
1626 (*properties)[data_reduction_proxy::chrome_proxy_header()] = | 1630 (*properties)[data_reduction_proxy::chrome_proxy_header()] = |
1627 data_reduction_proxy::chrome_proxy_lo_fi_directive(); | 1631 data_reduction_proxy::chrome_proxy_lo_fi_directive(); |
1628 } | 1632 } |
1629 } | 1633 } |
OLD | NEW |