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

Side by Side Diff: chrome/browser/android/chrome_intercept_navigation_resource_throttle.cc

Issue 10946008: Componentize IgnoreNavigationResourceThrottle and add chrome and webview specific implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/android/chrome_intercept_navigation_resource_throttle.h "
6
7 #include "base/callback.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/web_contents.h"
11 #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
12 #include "chrome/browser/android/tab_android.h"
13
14 using chrome::android::ChromeWebContentsDelegateAndroid;
15 using content::BrowserThread;
16 using content::RenderViewHost;
17 using content::WebContents;
18 using navigation_interception::InterceptNavigationResourceThrottle;
19
20 namespace chrome {
21 namespace android {
22
23 namespace {
24
25 bool CheckIfShouldIgnoreNavigationOnUIThread(RenderViewHost* source,
26 const GURL& url,
27 const content::Referrer& referrer,
28 bool is_content_initiated) {
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
30 DCHECK(source);
31
32 WebContents* web_contents = WebContents::FromRenderViewHost(source);
33 if (!web_contents) return false;
34 TabAndroid* tab_android = TabAndroid::FromWebContents(web_contents);
35 if (!tab_android) return false;
36 ChromeWebContentsDelegateAndroid* chrome_web_contents_delegate =
37 tab_android->GetChromeWebContentsDelegateAndroid();
38 if (!chrome_web_contents_delegate) return false;
39
40 return chrome_web_contents_delegate->ShouldIgnoreNavigation(
41 url, is_content_initiated);
42 }
43
44 } // namespace
45
46 // static
47 InterceptNavigationResourceThrottle*
48 ChromeInterceptNavigationResourceThrottle::Create(net::URLRequest* request) {
49 return new InterceptNavigationResourceThrottle(
50 request, base::Bind(&CheckIfShouldIgnoreNavigationOnUIThread));
51 }
52
53 } // namespace android
54 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698