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

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

Issue 2623593002: [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
123 // Browser initiated navigations like the Back button or the context menu 119 // Browser initiated navigations like the Back button or the context menu
124 // should never be intercepted. 120 // should never be intercepted.
125 if (!handle->IsRendererInitiated()) 121 if (!handle->IsRendererInitiated())
126 return nullptr; 122 return nullptr;
127 123
128 // The source URL may be empty, it's a new tab. Intercepting that navigation 124 // 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. 125 // would lead to a blank new tab, which would be bad.
130 GURL source_url = handle->GetWebContents()->GetLastCommittedURL(); 126 GURL source_url = handle->GetWebContents()->GetLastCommittedURL();
131 if (source_url.is_empty()) 127 if (source_url.is_empty())
132 return nullptr; 128 return nullptr;
133 129
134 Profile* profile = Profile::FromBrowserContext( 130 Profile* profile = Profile::FromBrowserContext(
135 handle->GetWebContents()->GetBrowserContext()); 131 handle->GetWebContents()->GetBrowserContext());
136 HostContentSettingsMap* host_content_settings_map = 132 HostContentSettingsMap* host_content_settings_map =
137 HostContentSettingsMapFactory::GetForProfile(profile); 133 HostContentSettingsMapFactory::GetForProfile(profile);
138 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url, 134 if (!ShouldStopFlashDownloadAction(host_content_settings_map, source_url,
139 handle->GetURL(), 135 handle->GetURL(),
140 handle->HasUserGesture())) { 136 handle->HasUserGesture())) {
141 return nullptr; 137 return nullptr;
142 } 138 }
143 139
144 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( 140 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>(
145 handle, base::Bind(&InterceptNavigation, source_url), true); 141 handle, base::Bind(&InterceptNavigation, source_url), true);
146 } 142 }
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