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

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

Issue 2272123002: [HBD] Intercept navigation to Flash download page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes per tommycli@'s comments Created 4 years, 3 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/plugins/flash_download_interception.h"
6
7 #include <string>
8
9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h"
11 #include "chrome/common/chrome_features.h"
12 #include "components/navigation_interception/intercept_navigation_throttle.h"
13 #include "components/navigation_interception/navigation_params.h"
14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/navigation_handle.h"
16 #include "content/public/browser/web_contents.h"
17
18 using content::BrowserThread;
19 using content::WebContents;
Lei Zhang 2016/08/25 00:55:06 not needed
trizzofo 2016/08/25 01:50:36 Done.
20 using content::NavigationHandle;
21 using content::NavigationThrottle;
22
23 namespace {
24
25 const char kFlashDownloadURL[] = "get.adobe.com/flashplayer";
26
27 bool ShouldInterceptNavigation(
Lei Zhang 2016/08/25 00:55:06 Does this need a comment or a TODO?
trizzofo 2016/08/25 01:50:36 Added a TODO to body.
28 content::WebContents* source,
29 const navigation_interception::NavigationParams& params) {
30 DCHECK_CURRENTLY_ON(BrowserThread::UI);
31 return true;
32 }
33
34 } // namespace
35
36 // static
37 std::unique_ptr<NavigationThrottle>
38 FlashDownloadInterception::MaybeCreateThrottleFor(NavigationHandle* handle) {
39 DCHECK_CURRENTLY_ON(BrowserThread::UI);
40
41 if (!base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins))
42 return nullptr;
43
44 if (!handle->HasUserGesture())
45 return nullptr;
46
47 if (handle->GetURL().GetContent().compare(0, strlen(kFlashDownloadURL),
Lei Zhang 2016/08/25 00:55:07 Use base::StartsWith() ?
trizzofo 2016/08/25 01:50:36 Done.
48 kFlashDownloadURL)) {
49 return nullptr;
50 }
51
52 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>(
53 handle, base::Bind(&ShouldInterceptNavigation), true);
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698