| 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 "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 11 #include "chrome/browser/plugins/plugins_field_trial.h" | 11 #include "chrome/browser/plugins/plugins_field_trial.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/chrome_features.h" | 13 #include "chrome/common/chrome_features.h" |
| 14 #include "components/content_settings/core/browser/host_content_settings_map.h" | 14 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 15 #include "components/navigation_interception/intercept_navigation_throttle.h" | 15 #include "components/navigation_interception/intercept_navigation_throttle.h" |
| 16 #include "components/navigation_interception/navigation_params.h" | 16 #include "components/navigation_interception/navigation_params.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/navigation_handle.h" | 18 #include "content/public/browser/navigation_handle.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 | 20 |
| 21 using content::BrowserThread; | 21 using content::BrowserThread; |
| 22 using content::NavigationHandle; | 22 using content::NavigationHandle; |
| 23 using content::NavigationThrottle; | 23 using content::NavigationThrottle; |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 const char kFlashDownloadURL[] = "get.adobe.com/flashplayer"; | 27 const char kFlashDownloadURL[] = "get.adobe.com/flash"; |
| 28 | 28 |
| 29 bool ShouldInterceptNavigation( | 29 bool ShouldInterceptNavigation( |
| 30 content::WebContents* source, | 30 content::WebContents* source, |
| 31 const navigation_interception::NavigationParams& params) { | 31 const navigation_interception::NavigationParams& params) { |
| 32 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 32 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 33 // TODO(crbug.com/626728): Implement permission prompt logic. | 33 // TODO(crbug.com/626728): Implement permission prompt logic. |
| 34 return true; | 34 return true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 GURL source_url = handle->GetWebContents()->GetLastCommittedURL(); | 81 GURL source_url = handle->GetWebContents()->GetLastCommittedURL(); |
| 82 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, | 82 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, |
| 83 handle->GetURL(), | 83 handle->GetURL(), |
| 84 handle->HasUserGesture())) { | 84 handle->HasUserGesture())) { |
| 85 return nullptr; | 85 return nullptr; |
| 86 } | 86 } |
| 87 | 87 |
| 88 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( | 88 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( |
| 89 handle, base::Bind(&ShouldInterceptNavigation), true); | 89 handle, base::Bind(&ShouldInterceptNavigation), true); |
| 90 } | 90 } |
| OLD | NEW |