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

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

Issue 1350913008: Revert of Add a NavigationThrottle to the public content/ interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-api
Patch Set: Created 5 years, 2 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_throttle.h" 10 #include "components/navigation_interception/intercept_navigation_resource_throt tle.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"
14 #include "content/public/browser/render_frame_host.h" 13 #include "content/public/browser/render_frame_host.h"
15 #include "content/public/browser/render_view_host.h" 14 #include "content/public/browser/render_view_host.h"
16 #include "content/public/browser/resource_request_info.h" 15 #include "content/public/browser/resource_request_info.h"
17 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
18 #include "jni/InterceptNavigationDelegate_jni.h" 17 #include "jni/InterceptNavigationDelegate_jni.h"
19 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
20 #include "url/gurl.h" 19 #include "url/gurl.h"
21 20
22 using base::android::ConvertUTF8ToJavaString; 21 using base::android::ConvertUTF8ToJavaString;
23 using base::android::ScopedJavaLocalRef; 22 using base::android::ScopedJavaLocalRef;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 76 }
78 77
79 // static 78 // static
80 InterceptNavigationDelegate* InterceptNavigationDelegate::Get( 79 InterceptNavigationDelegate* InterceptNavigationDelegate::Get(
81 WebContents* web_contents) { 80 WebContents* web_contents) {
82 return static_cast<InterceptNavigationDelegate*>( 81 return static_cast<InterceptNavigationDelegate*>(
83 web_contents->GetUserData(kInterceptNavigationDelegateUserDataKey)); 82 web_contents->GetUserData(kInterceptNavigationDelegateUserDataKey));
84 } 83 }
85 84
86 // static 85 // static
87 scoped_ptr<content::NavigationThrottle> 86 content::ResourceThrottle* InterceptNavigationDelegate::CreateThrottleFor(
88 InterceptNavigationDelegate::CreateThrottleFor( 87 net::URLRequest* request) {
89 content::NavigationHandle* handle) { 88 return new InterceptNavigationResourceThrottle(
90 return scoped_ptr<content::NavigationThrottle>( 89 request, base::Bind(&CheckIfShouldIgnoreNavigationOnUIThread));
91 new InterceptNavigationThrottle(
92 handle, base::Bind(&CheckIfShouldIgnoreNavigationOnUIThread)));
93 } 90 }
94 91
95 // static 92 // static
96 void InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo( 93 void InterceptNavigationDelegate::UpdateUserGestureCarryoverInfo(
97 net::URLRequest* request) { 94 net::URLRequest* request) {
98 const content::ResourceRequestInfo* info = 95 const content::ResourceRequestInfo* info =
99 content::ResourceRequestInfo::ForRequest(request); 96 content::ResourceRequestInfo::ForRequest(request);
100 if (!info || !info->HasUserGesture()) 97 if (!info || !info->HasUserGesture())
101 return; 98 return;
102 99
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 last_user_gesture_carryover_timestamp_ = base::TimeTicks::Now(); 144 last_user_gesture_carryover_timestamp_ = base::TimeTicks::Now();
148 } 145 }
149 146
150 // Register native methods. 147 // Register native methods.
151 148
152 bool RegisterInterceptNavigationDelegate(JNIEnv* env) { 149 bool RegisterInterceptNavigationDelegate(JNIEnv* env) {
153 return RegisterNativesImpl(env); 150 return RegisterNativesImpl(env);
154 } 151 }
155 152
156 } // namespace navigation_interception 153 } // namespace navigation_interception
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698