| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // The source URL may be empty, it's a new tab. Intercepting that navigation | 128 // The source URL may be empty, it's a new tab. Intercepting that navigation |
| 129 // would lead to a blank new tab, which would be bad. | 129 // would lead to a blank new tab, which would be bad. |
| 130 GURL source_url = handle->GetWebContents()->GetLastCommittedURL(); | 130 GURL source_url = handle->GetWebContents()->GetLastCommittedURL(); |
| 131 if (source_url.is_empty()) | 131 if (source_url.is_empty()) |
| 132 return nullptr; | 132 return nullptr; |
| 133 | 133 |
| 134 Profile* profile = Profile::FromBrowserContext( | 134 Profile* profile = Profile::FromBrowserContext( |
| 135 handle->GetWebContents()->GetBrowserContext()); | 135 handle->GetWebContents()->GetBrowserContext()); |
| 136 HostContentSettingsMap* host_content_settings_map = | 136 HostContentSettingsMap* host_content_settings_map = |
| 137 HostContentSettingsMapFactory::GetForProfile(profile); | 137 HostContentSettingsMapFactory::GetForProfile(profile); |
| 138 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, | 138 if (!ShouldStopFlashDownloadAction( |
| 139 handle->GetURL(), | 139 host_content_settings_map, source_url, handle->GetURL(), |
| 140 handle->HasUserGesture())) { | 140 handle->GetNavigationGesture() == content::NavigationGestureUser)) { |
| 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 |