Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8694)

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 2011623002: Cherry-picking hangouts.google.com whitelisting change into M52. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..979878066e070633b09f7d456dd34b8570131064 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -32,6 +32,7 @@
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/locale_settings.h"
#include "chrome/grit/renderer_resources.h"
+#include "chrome/renderer/app_categorizer.h"
#include "chrome/renderer/banners/app_banner_client.h"
#include "chrome/renderer/benchmarking_extension.h"
#include "chrome/renderer/chrome_render_frame_observer.h"
@@ -903,44 +904,9 @@ bool ChromeContentRendererClient::IsNaClAllowed(
const Extension* extension,
WebPluginParams* params) {
// Temporarily allow these whitelisted apps and WebUIs to use NaCl.
- std::string app_url_host = app_url.host();
- std::string manifest_url_path = manifest_url.path();
-
bool is_whitelisted_web_ui =
app_url.spec() == chrome::kChromeUIAppListStartPageURL;
- 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)) &&
- manifest_url.DomainIs("ssl.gstatic.com") &&
- (manifest_url_path.find("s2/oz/nacl/") == 1 ||
- manifest_url_path.find("photos/nacl/") == 1);
-
- std::string manifest_fs_host;
- if (manifest_url.SchemeIsFileSystem() && manifest_url.inner_url()) {
- manifest_fs_host = manifest_url.inner_url()->host();
- }
- bool is_hangouts_app =
- // 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)) &&
- // The manifest must be loaded from the host's FileSystem.
- (manifest_fs_host == app_url_host);
-
- bool is_whitelisted_app = is_photo_app || is_hangouts_app;
-
bool is_invoked_by_webstore_installed_extension = false;
bool is_extension_unrestricted = false;
bool is_extension_force_installed = false;
@@ -973,7 +939,7 @@ bool ChromeContentRendererClient::IsNaClAllowed(
// 5) --enable-nacl is set.
bool is_nacl_allowed_by_location =
is_whitelisted_web_ui ||
- is_whitelisted_app ||
+ AppCategorizer::IsWhitelistedApp(manifest_url, app_url) ||
is_extension_unrestricted ||
is_extension_force_installed ||
is_invoked_by_webstore_installed_extension;
@@ -1229,29 +1195,20 @@ 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;
- }
+#if defined(OS_ANDROID)
+ return false;
+#else
// Allow access for tests.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePepperTesting)) {
return true;
}
+
+ // 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 (AppCategorizer::IsHangoutsUrl(url));
#endif // !defined(OS_ANDROID)
- return false;
}
void ChromeContentRendererClient::AddSupportedKeySystems(
« no previous file with comments | « chrome/renderer/app_categorizer_unittest.cc ('k') | chrome/renderer/chrome_content_renderer_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698