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

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: Created 4 years, 4 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 "components/navigation_interception/intercept_navigation_throttle.h"
12 #include "components/navigation_interception/navigation_params.h"
13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/navigation_handle.h"
15 #include "content/public/browser/web_contents.h"
16
17 using content::BrowserThread;
18 using content::WebContents;
19
20 namespace {
21
22 const char kFlashDownloadURL[] = "get.adobe.com/flashplayer";
23
24 bool ShouldInterceptNavigation(
25 content::WebContents* source,
26 const navigation_interception::NavigationParams& params) {
27 DCHECK_CURRENTLY_ON(BrowserThread::UI);
28 return true;
29 }
30
31 } // namespace
32
33 // static
34 std::unique_ptr<content::NavigationThrottle>
35 FlashDownloadInterception::MaybeCreateThrottleFor(
tommycli 2016/08/24 19:11:30 nit: You ran git cl format right?
trizzofo 2016/08/24 22:45:13 Yes, I ran it. I've now added a "using content::Na
36 content::NavigationHandle* handle) {
37 DCHECK_CURRENTLY_ON(BrowserThread::UI);
38
39 if (!handle->HasUserGesture())
40 return nullptr;
41
42 if (handle->GetURL().GetContent().compare(0, strlen(kFlashDownloadURL),
43 kFlashDownloadURL)) {
44 return nullptr;
45 }
46
47 return base::MakeUnique<navigation_interception::InterceptNavigationThrottle>(
48 handle, base::Bind(&ShouldInterceptNavigation), true);
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698