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

Side by Side Diff: chrome/browser/plugins/flash_download_interception.cc

Issue 2622643004: Revert of [HBD] Intercept Flash navigations in popup windows. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/plugins/flash_permission_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 return false; 111 return false;
112 } 112 }
113 113
114 // static 114 // static
115 std::unique_ptr<NavigationThrottle> 115 std::unique_ptr<NavigationThrottle>
116 FlashDownloadInterception::MaybeCreateThrottleFor(NavigationHandle* handle) { 116 FlashDownloadInterception::MaybeCreateThrottleFor(NavigationHandle* handle) {
117 DCHECK_CURRENTLY_ON(BrowserThread::UI); 117 DCHECK_CURRENTLY_ON(BrowserThread::UI);
118 118
119 // Never intercept Flash Download navigations in a new window.
120 if (handle->GetWebContents()->HasOpener())
121 return nullptr;
122
119 // Browser initiated navigations like the Back button or the context menu 123 // Browser initiated navigations like the Back button or the context menu
120 // should never be intercepted. 124 // should never be intercepted.
121 if (!handle->IsRendererInitiated()) 125 if (!handle->IsRendererInitiated())
122 return nullptr; 126 return nullptr;
123 127
124 // 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
125 // would lead to a blank new tab, which would be bad. 129 // would lead to a blank new tab, which would be bad.
126 GURL source_url = handle->GetWebContents()->GetLastCommittedURL(); 130 GURL source_url = handle->GetWebContents()->GetLastCommittedURL();
127 if (source_url.is_empty()) 131 if (source_url.is_empty())
128 return nullptr; 132 return nullptr;
129 133
130 Profile* profile = Profile::FromBrowserContext( 134 Profile* profile = Profile::FromBrowserContext(
131 handle->GetWebContents()->GetBrowserContext()); 135 handle->GetWebContents()->GetBrowserContext());
132 HostContentSettingsMap* host_content_settings_map = 136 HostContentSettingsMap* host_content_settings_map =
133 HostContentSettingsMapFactory::GetForProfile(profile); 137 HostContentSettingsMapFactory::GetForProfile(profile);
134 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, 138 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url,
135 handle->GetURL(), 139 handle->GetURL(),
136 handle->HasUserGesture())) { 140 handle->HasUserGesture())) {
137 return nullptr; 141 return nullptr;
138 } 142 }
139 143
140 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( 144 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>(
141 handle, base::Bind(&InterceptNavigation, source_url), true); 145 handle, base::Bind(&InterceptNavigation, source_url), true);
142 } 146 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/plugins/flash_permission_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698