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 18 matching lines...) Expand all Loading... |
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)get\\.adobe\\.com/.*flash.*"; |
34 const char kGetFlashURLSecondaryRegex[] = | 34 const char kGetFlashURLSecondaryRegex[] = |
35 "(?i)(www\\.)?(adobe|macromedia)\\.com/go.*" | 35 "(?i)(www\\.)?(adobe|macromedia)\\.com/go.*" |
36 "(get[-_]?flash|fl(ash)?.?pl(ayer)?|flash_completion|flashpm|flashdownload|" | 36 "(get[-_]?flash|fl(ash)?.?pl(ayer)?|flash_completion|flashpm|flashdownload|" |
37 "fp|h-m-a-?2|chrome|download_player|gnav_fl|pdcredirect).*"; | 37 "fp|h-m-a-?2|chrome|download_player|gnav_fl|pdcredirect).*"; |
38 | 38 |
39 void DoNothing(blink::mojom::PermissionStatus result) {} | 39 void DoNothing(ContentSetting result) {} |
40 | 40 |
41 bool InterceptNavigation( | 41 bool InterceptNavigation( |
42 const GURL& source_url, | 42 const GURL& source_url, |
43 content::WebContents* source, | 43 content::WebContents* source, |
44 const navigation_interception::NavigationParams& params) { | 44 const navigation_interception::NavigationParams& params) { |
45 FlashDownloadInterception::InterceptFlashDownloadNavigation(source, | 45 FlashDownloadInterception::InterceptFlashDownloadNavigation(source, |
46 source_url); | 46 source_url); |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 HostContentSettingsMap* host_content_settings_map = | 137 HostContentSettingsMap* host_content_settings_map = |
138 HostContentSettingsMapFactory::GetForProfile(profile); | 138 HostContentSettingsMapFactory::GetForProfile(profile); |
139 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, | 139 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, |
140 handle->GetURL(), has_user_gesture)) { | 140 handle->GetURL(), has_user_gesture)) { |
141 return nullptr; | 141 return nullptr; |
142 } | 142 } |
143 | 143 |
144 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( | 144 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( |
145 handle, base::Bind(&InterceptNavigation, source_url), true); | 145 handle, base::Bind(&InterceptNavigation, source_url), true); |
146 } | 146 } |
OLD | NEW |