OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/plugins/flash_download_interception.h" | 5 #include "chrome/browser/plugins/flash_download_interception.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "third_party/re2/src/re2/re2.h" | 23 #include "third_party/re2/src/re2/re2.h" |
24 #include "url/origin.h" | 24 #include "url/origin.h" |
25 | 25 |
26 using content::BrowserThread; | 26 using content::BrowserThread; |
27 using content::NavigationHandle; | 27 using content::NavigationHandle; |
28 using content::NavigationThrottle; | 28 using content::NavigationThrottle; |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 // Regexes matching | 32 // Regexes matching |
33 const char kGetFlashURLCanonicalRegex[] = "(?i)get\\.adobe\\.com/.*flash.*"; | 33 const char kGetFlashURLCanonicalRegex[] = "(?i)get2?\\.adobe\\.com/.*flash.*"; |
34 const char kGetFlashURLSecondaryGoRegex[] = | 34 const char kGetFlashURLSecondaryGoRegex[] = |
35 "(?i)(www\\.)?(adobe|macromedia)\\.com/go/" | 35 "(?i)(www\\.)?(adobe|macromedia)\\.com/go/" |
36 "((?i).*get[-_]?flash|getfp10android|.*fl(ash)player|.*flashpl|" | 36 "((?i).*get[-_]?flash|getfp10android|.*fl(ash)player|.*flashpl|" |
37 ".*flash_player|flash_completion|flashpm|.*flashdownload|d65_flplayer|" | 37 ".*flash_player|flash_completion|flashpm|.*flashdownload|d65_flplayer|" |
38 "fp_jp|runtimes_fp|[a-z_-]{3,6}h-m-a-?2|chrome|download_player|" | 38 "fp_jp|runtimes_fp|[a-z_-]{3,6}h-m-a-?2|chrome|download_player|" |
39 "gnav_fl|pdcredirect).*"; | 39 "gnav_fl|pdcredirect).*"; |
40 const char kGetFlashURLSecondaryDownloadRegex[] = | 40 const char kGetFlashURLSecondaryDownloadRegex[] = |
41 "(?i)(www\\.)?(adobe|macromedia)\\.com/shockwave/download/download.cgi"; | 41 "(?i)(www\\.)?(adobe|macromedia)\\.com/shockwave/download/download.cgi"; |
42 const char kGetFlashURLSecondaryDownloadQuery[] = | 42 const char kGetFlashURLSecondaryDownloadQuery[] = |
43 "P1_Prod_Version=ShockwaveFlash"; | 43 "P1_Prod_Version=ShockwaveFlash"; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 HostContentSettingsMap* host_content_settings_map = | 154 HostContentSettingsMap* host_content_settings_map = |
155 HostContentSettingsMapFactory::GetForProfile(profile); | 155 HostContentSettingsMapFactory::GetForProfile(profile); |
156 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, | 156 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, |
157 handle->GetURL(), has_user_gesture)) { | 157 handle->GetURL(), has_user_gesture)) { |
158 return nullptr; | 158 return nullptr; |
159 } | 159 } |
160 | 160 |
161 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( | 161 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( |
162 handle, base::Bind(&InterceptNavigation, source_url), true); | 162 handle, base::Bind(&InterceptNavigation, source_url), true); |
163 } | 163 } |
OLD | NEW |