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

Side by Side Diff: chrome/browser/component/navigation_interception/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: fixed presubmit warning for jni_generator.py Created 8 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 | Annotate | Revision Log
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 "chrome/browser/renderer_host/intercept_navigation_resource_throttle.h" 5 #include "chrome/browser/component/navigation_interception/intercept_navigation_ resource_throttle.h"
6 6
7 #include "content/public/browser/browser_thread.h" 7 #include "content/public/browser/browser_thread.h"
8 #include "content/public/browser/child_process_security_policy.h" 8 #include "content/public/browser/child_process_security_policy.h"
9 #include "content/public/browser/render_view_host.h" 9 #include "content/public/browser/render_view_host.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
11 #include "content/public/browser/resource_request_info.h" 11 #include "content/public/browser/resource_request_info.h"
12 #include "content/public/browser/resource_controller.h" 12 #include "content/public/browser/resource_controller.h"
13 #include "content/public/common/referrer.h" 13 #include "content/public/common/referrer.h"
14 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
15 15
16 using content::BrowserThread; 16 using content::BrowserThread;
17 using content::ChildProcessSecurityPolicy; 17 using content::ChildProcessSecurityPolicy;
18 using content::Referrer; 18 using content::Referrer;
19 using content::RenderViewHost; 19 using content::RenderViewHost;
20 using content::ResourceRequestInfo; 20 using content::ResourceRequestInfo;
21 21
22 namespace navigation_interception {
23
22 namespace { 24 namespace {
23 25
24 void CheckIfShouldIgnoreNavigationOnUIThread( 26 void CheckIfShouldIgnoreNavigationOnUIThread(
25 int render_process_id, 27 int render_process_id,
26 int render_view_id, 28 int render_view_id,
27 const GURL& url, 29 const GURL& url,
28 const Referrer& referrer, 30 const Referrer& referrer,
29 bool is_content_initiated, 31 bool has_user_gesture,
30 InterceptNavigationResourceThrottle::CheckOnUIThreadCallback 32 InterceptNavigationResourceThrottle::CheckOnUIThreadCallback
31 should_ignore_callback, 33 should_ignore_callback,
32 base::Callback<void(bool)> callback) { 34 base::Callback<void(bool)> callback) {
33 35
34 RenderViewHost* rvh = 36 RenderViewHost* rvh =
35 RenderViewHost::FromID(render_process_id, render_view_id); 37 RenderViewHost::FromID(render_process_id, render_view_id);
36 38
37 GURL validated_url(url); 39 GURL validated_url(url);
38 RenderViewHost::FilterURL( 40 RenderViewHost::FilterURL(
39 rvh->GetProcess()->GetID(), 41 rvh->GetProcess()->GetID(),
40 false, 42 false,
41 &validated_url); 43 &validated_url);
42 44
43 bool should_ignore_navigation = false; 45 bool should_ignore_navigation = false;
44 should_ignore_navigation = should_ignore_callback.Run( 46 should_ignore_navigation = should_ignore_callback.Run(
45 rvh, validated_url, referrer, is_content_initiated); 47 rvh, validated_url, referrer, has_user_gesture);
46 48
47 BrowserThread::PostTask( 49 BrowserThread::PostTask(
48 BrowserThread::IO, 50 BrowserThread::IO,
49 FROM_HERE, 51 FROM_HERE,
50 base::Bind(callback, should_ignore_navigation)); 52 base::Bind(callback, should_ignore_navigation));
51 } 53 }
52 54
53 } // namespace 55 } // namespace
54 56
55 InterceptNavigationResourceThrottle::InterceptNavigationResourceThrottle( 57 InterceptNavigationResourceThrottle::InterceptNavigationResourceThrottle(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 void InterceptNavigationResourceThrottle::OnResultObtained( 112 void InterceptNavigationResourceThrottle::OnResultObtained(
111 bool should_ignore_navigation) { 113 bool should_ignore_navigation) {
112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
113 115
114 if (should_ignore_navigation) { 116 if (should_ignore_navigation) {
115 controller()->CancelAndIgnore(); 117 controller()->CancelAndIgnore();
116 } else { 118 } else {
117 controller()->Resume(); 119 controller()->Resume();
118 } 120 }
119 } 121 }
122
123 } // namespace navigation_interception
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698