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

Unified Diff: chrome/browser/plugins/flash_download_interception.cc

Issue 2699993002: [HBD]: Add additional intercept URL.
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/plugins/flash_download_interception_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/flash_download_interception.cc
diff --git a/chrome/browser/plugins/flash_download_interception.cc b/chrome/browser/plugins/flash_download_interception.cc
index f46a1e06c0e14a572f3e8bf93f15d31ff2255812..d82d35803252c608df4375f377cdbea4d5eba2de 100644
--- a/chrome/browser/plugins/flash_download_interception.cc
+++ b/chrome/browser/plugins/flash_download_interception.cc
@@ -31,10 +31,12 @@ namespace {
// Regexes matching
const char kGetFlashURLCanonicalRegex[] = "(?i)get\\.adobe\\.com/.*flash.*";
-const char kGetFlashURLSecondaryRegex[] =
+const char kGetFlashURLGoLinkRegex[] =
"(?i)(www\\.)?(adobe|macromedia)\\.com/go.*"
"(get[-_]?flash|fl(ash)?.?pl(ayer)?|flash_completion|flashpm|flashdownload|"
"fp|h-m-a-?2|chrome|download_player|gnav_fl|pdcredirect).*";
+const char kGetFlashURLShockwaveRegex[] =
+ "(?i)(www\\.)?(adobe)\\.com/shockwave/download.*";
void DoNothing(blink::mojom::PermissionStatus result) {}
@@ -65,6 +67,7 @@ void FlashDownloadInterception::InterceptFlashDownloadNavigation(
host_content_settings_map, CONTENT_SETTINGS_TYPE_PLUGINS, flash_setting);
if (flash_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) {
+ printf("Requesting permission...\n");
PermissionManager* manager = PermissionManager::Get(profile);
manager->RequestPermission(
content::PermissionType::FLASH, web_contents->GetMainFrame(),
@@ -95,8 +98,10 @@ bool FlashDownloadInterception::ShouldStopFlashDownloadAction(
return false;
std::string target_url_str = target_url.GetContent();
+ printf("target url: %s\n", target_url_str.c_str());
if (RE2::FullMatch(target_url_str, kGetFlashURLCanonicalRegex) ||
- RE2::FullMatch(target_url_str, kGetFlashURLSecondaryRegex)) {
+ RE2::FullMatch(target_url_str, kGetFlashURLGoLinkRegex) ||
+ RE2::FullMatch(target_url_str, kGetFlashURLShockwaveRegex)) {
ContentSetting flash_setting = PluginUtils::GetFlashPluginContentSetting(
host_content_settings_map, url::Origin(source_url), source_url,
nullptr);
@@ -121,6 +126,11 @@ FlashDownloadInterception::MaybeCreateThrottleFor(NavigationHandle* handle) {
if (!handle->IsRendererInitiated())
return nullptr;
+ printf("Src url: %s target: %s, has gesture %d, main frame %d\n",
+ handle->GetWebContents()->GetLastCommittedURL().spec().c_str(),
+ handle->GetURL().spec().c_str(),
+ handle->HasUserGesture(), handle->IsInMainFrame());
+
// The source URL may be empty, it's a new tab. Intercepting that navigation
// would lead to a blank new tab, which would be bad.
GURL source_url = handle->GetWebContents()->GetLastCommittedURL();
@@ -141,6 +151,7 @@ FlashDownloadInterception::MaybeCreateThrottleFor(NavigationHandle* handle) {
return nullptr;
}
+ printf("making nav throttle\n");
return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>(
handle, base::Bind(&InterceptNavigation, source_url), true);
}
« no previous file with comments | « no previous file | chrome/browser/plugins/flash_download_interception_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698