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

Side by Side Diff: components/navigation_interception/intercept_navigation_delegate.cc

Issue 1269813002: Add a NavigationThrottle to the public content/ interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-api
Patch Set: Addressed comments Created 5 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/navigation_interception/intercept_navigation_delegate.h" 5 #include "components/navigation_interception/intercept_navigation_delegate.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h" 10 #include "components/navigation_interception/intercept_navigation_throttle.h"
11 #include "components/navigation_interception/navigation_params_android.h" 11 #include "components/navigation_interception/navigation_params_android.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/navigation_throttle.h"
13 #include "content/public/browser/render_frame_host.h" 14 #include "content/public/browser/render_frame_host.h"
14 #include "content/public/browser/render_view_host.h" 15 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/resource_request_info.h" 16 #include "content/public/browser/resource_request_info.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 #include "jni/InterceptNavigationDelegate_jni.h" 18 #include "jni/InterceptNavigationDelegate_jni.h"
18 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 21
21 using base::android::ConvertUTF8ToJavaString; 22 using base::android::ConvertUTF8ToJavaString;
22 using base::android::ScopedJavaLocalRef; 23 using base::android::ScopedJavaLocalRef;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 77 }
77 78
78 // static 79 // static
79 InterceptNavigationDelegate* InterceptNavigationDelegate::Get( 80 InterceptNavigationDelegate* InterceptNavigationDelegate::Get(
80 WebContents* web_contents) { 81 WebContents* web_contents) {
81 return static_cast<InterceptNavigationDelegate*>( 82 return static_cast<InterceptNavigationDelegate*>(
82 web_contents->GetUserData(kInterceptNavigationDelegateUserDataKey)); 83 web_contents->GetUserData(kInterceptNavigationDelegateUserDataKey));
83 } 84 }
84 85
85 // static 86 // static
86 content::ResourceThrottle* InterceptNavigationDelegate::CreateThrottleFor( 87 content::NavigationThrottle* InterceptNavigationDelegate::CreateThrottleFor(
87 net::URLRequest* request) { 88 content::NavigationHandle* handle,
88 return new InterceptNavigationResourceThrottle( 89 content::WebContents* web_contents) {
nasko 2015/09/14 22:00:04 Isn't the web_contents parameter dropped on this m
clamy 2015/09/16 01:03:21 Done.
89 request, base::Bind(&CheckIfShouldIgnoreNavigationOnUIThread)); 90 return new InterceptNavigationThrottle(
91 web_contents, handle,
92 base::Bind(&CheckIfShouldIgnoreNavigationOnUIThread));
90 } 93 }
91 94
92 // static 95 // static
93 void InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo( 96 void InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(
94 net::URLRequest* request) { 97 net::URLRequest* request) {
95 const content::ResourceRequestInfo* info = 98 const content::ResourceRequestInfo* info =
96 content::ResourceRequestInfo::ForRequest(request); 99 content::ResourceRequestInfo::ForRequest(request);
97 if (!info || !info->HasUserGesture()) 100 if (!info || !info->HasUserGesture())
98 return; 101 return;
99 102
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 last_user_gesture_carryover_timestamp_ = base::TimeTicks::Now(); 147 last_user_gesture_carryover_timestamp_ = base::TimeTicks::Now();
145 } 148 }
146 149
147 // Register native methods. 150 // Register native methods.
148 151
149 bool RegisterInterceptNavigationDelegate(JNIEnv* env) { 152 bool RegisterInterceptNavigationDelegate(JNIEnv* env) {
150 return RegisterNativesImpl(env); 153 return RegisterNativesImpl(env);
151 } 154 }
152 155
153 } // namespace navigation_interception 156 } // namespace navigation_interception
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698