Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 } | |
| OLD | NEW |