Chromium Code Reviews| Index: chrome/renderer/chrome_content_renderer_client.cc |
| diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc |
| index b70bbeb30f38116b330225195fd5cc357c2a915f..9d2f48eaea819f13ee71f716456e83bd2d0940ff 100644 |
| --- a/chrome/renderer/chrome_content_renderer_client.cc |
| +++ b/chrome/renderer/chrome_content_renderer_client.cc |
| @@ -185,6 +185,8 @@ using extensions::Extension; |
| namespace { |
| +const char* const kGoogleComDomainSuffix = ".google.com"; |
| + |
| // Whitelist PPAPI for Android Runtime for Chromium. (See crbug.com/383937) |
| #if defined(ENABLE_PLUGINS) |
| const char* const kPredefinedAllowedCameraDeviceOrigins[] = { |
| @@ -912,10 +914,8 @@ bool ChromeContentRendererClient::IsNaClAllowed( |
| bool is_photo_app = |
| // Whitelisted apps must be served over https. |
| app_url.SchemeIsCryptographic() && manifest_url.SchemeIsCryptographic() && |
| - (base::EndsWith(app_url_host, "plus.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII) || |
| - base::EndsWith(app_url_host, "plus.sandbox.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII)) && |
| + base::EndsWith(app_url_host, kGoogleComDomainSuffix, |
| + base::CompareCase::INSENSITIVE_ASCII) && |
| manifest_url.DomainIs("ssl.gstatic.com") && |
| (manifest_url_path.find("s2/oz/nacl/") == 1 || |
| manifest_url_path.find("photos/nacl/") == 1); |
| @@ -928,14 +928,8 @@ bool ChromeContentRendererClient::IsNaClAllowed( |
| // Whitelisted apps must be served over secure scheme. |
| app_url.SchemeIsCryptographic() && manifest_url.SchemeIsFileSystem() && |
| manifest_url.inner_url()->SchemeIsCryptographic() && |
| - (base::EndsWith(app_url_host, "talkgadget.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII) || |
| - base::EndsWith(app_url_host, "plus.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII) || |
| - base::EndsWith(app_url_host, "plus.sandbox.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII) || |
| - base::EndsWith(app_url_host, "hangouts.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII)) && |
| + base::EndsWith(app_url_host, kGoogleComDomainSuffix, |
| + base::CompareCase::INSENSITIVE_ASCII) && |
| // The manifest must be loaded from the host's FileSystem. |
| (manifest_fs_host == app_url_host); |
| @@ -1230,26 +1224,24 @@ ChromeContentRendererClient::OverrideSpeechSynthesizer( |
| bool ChromeContentRendererClient::AllowPepperMediaStreamAPI( |
| const GURL& url) { |
| #if !defined(OS_ANDROID) |
| - // Allow only the Hangouts app to use the MediaStream APIs. It's OK to check |
| - // the whitelist in the renderer, since we're only preventing access until |
| - // these APIs are public and stable. |
| - std::string url_host = url.host(); |
| - if (url.SchemeIs("https") && |
| - (base::EndsWith(url_host, "talkgadget.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII) || |
| - base::EndsWith(url_host, "plus.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII) || |
| - base::EndsWith(url_host, "plus.sandbox.google.com", |
| - base::CompareCase::INSENSITIVE_ASCII)) && |
| - base::StartsWith(url.path(), "/hangouts/", |
| - base::CompareCase::INSENSITIVE_ASCII)) { |
| - return true; |
| - } |
| // Allow access for tests. |
| if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kEnablePepperTesting)) { |
| return true; |
| } |
| + |
| + std::string url_host = url.host(); |
|
tommi (sloooow) - chröme
2016/05/17 17:10:44
I don't think you need this copy now.
AlexZ
2016/05/17 17:20:24
It's still in use at line 1235 below.
tommi (sloooow) - chröme
2016/05/17 17:25:38
I mean, you could call url.host() inline there and
AlexZ
2016/05/17 17:33:55
Done.
|
| + if (!url.SchemeIs(url::kHttpsScheme) || |
| + !base::EndsWith(url_host, kGoogleComDomainSuffix, |
| + base::CompareCase::INSENSITIVE_ASCII)) { |
| + return false; |
| + } |
| + |
| + // Allow only the Hangouts app to use the MediaStream APIs. It's OK to check |
| + // the whitelist in the renderer, since we're only preventing access until |
| + // these APIs are public and stable. |
| + return base::StartsWith(url.path(), "/hangouts/", |
| + base::CompareCase::INSENSITIVE_ASCII); |
| #endif // !defined(OS_ANDROID) |
| return false; |
| } |