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

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

Issue 2524763002: make NavigationGesture part of public content API and use it outside content (Closed)
Patch Set: Created 4 years 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
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/page_load_metrics/page_load_tracker.cc ('k') | chrome/browser/plugins/flash_download_interception_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698