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

Side by Side Diff: android_webview/native/aw_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 #include "android_webview/browser/aw_intercept_navigation_resource_throttle.h"
benm (inactive) 2012/09/19 11:04:04 copyright
mkosiba (inactive) 2012/09/25 18:01:47 Done.
2
3 #include "base/callback.h"
4 #include "android_webview/native/aw_contents.h"
5 #include "android_webview/native/aw_web_contents_delegate.h"
6 #include "content/public/browser/browser_thread.h"
7 #include "content/public/browser/render_view_host.h"
8 #include "content/public/browser/web_contents.h"
9
10 using content::BrowserThread;
11 using content::RenderViewHost;
12 using content::WebContents;
13 using navigation_interception::InterceptNavigationResourceThrottle;
14
15 namespace android_webview {
16
17 namespace {
18
19 bool CheckIfShouldIgnoreNavigationOnUIThread(RenderViewHost* source,
20 const GURL& url,
21 const content::Referrer& referrer,
22 bool is_content_initiated) {
23 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
24 DCHECK(source);
25
26 WebContents* web_contents = WebContents::FromRenderViewHost(source);
27 if (!web_contents) return false;
28 AwContents* aw_contents = AwContents::FromWebContents(web_contents);
29 if (!web_contents) return false;
30 AwWebContentsDelegate* aw_web_contents_delegate =
31 aw_contents->GetAwWebContentsDelegate();
32 if (!aw_web_contents_delegate) return false;
33
34 return aw_web_contents_delegate->ShouldIgnoreNavigation(url);
35 }
36
37 } // namespace
38
39 //static
40 InterceptNavigationResourceThrottle*
41 AwInterceptNavigationResourceThrottle::Create(net::URLRequest* request) {
42 return new InterceptNavigationResourceThrottle(
43 request, base::Bind(&CheckIfShouldIgnoreNavigationOnUIThread));
44 }
45
46 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698