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

Side by Side Diff: content/components/navigation_interception/intercept_navigation_delegate.h

Issue 11830043: Move content/components/navigation_interception to src/components (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 11 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
(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 #ifndef CONTENT_COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE _H_
6 #define CONTENT_COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE _H_
7
8 #include "base/android/jni_helper.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/supports_user_data.h"
11 #include "content/public/common/page_transition_types.h"
12
13 class GURL;
14
15 namespace content {
16 class ResourceThrottle;
17 class WebContents;
18 }
19
20 namespace net {
21 class URLRequest;
22 }
23
24 namespace content {
25
26 // Native side of the InterceptNavigationDelegate Java interface.
27 // This is used to create a InterceptNavigationResourceThrottle that calls the
28 // Java interface method to determine whether a navigation should be ignored or
29 // not.
30 // To us this class:
31 // 1) the Java-side interface implementation must be associated (via the
32 // Associate method) with a WebContents for which URLRequests are to be
33 // intercepted,
34 // 2) the ResourceThrottle obtained via CreateThrottleFor must be associated
35 // with the URLRequests in the ResourceDispatcherHostDelegate
36 // implementation.
37 class InterceptNavigationDelegate : public base::SupportsUserData::Data {
38 public:
39 InterceptNavigationDelegate(JNIEnv* env, jobject jdelegate);
40 virtual ~InterceptNavigationDelegate();
41
42 // Associates the InterceptNavigationDelegate with a WebContents using the
43 // SupportsUserData mechanism.
44 // As implied by the use of scoped_ptr, the WebContents will assume ownership
45 // of |delegate|.
46 static void Associate(content::WebContents* web_contents,
47 scoped_ptr<InterceptNavigationDelegate> delegate);
48 // Gets the InterceptNavigationDelegate associated with the WebContents,
49 // can be null.
50 static InterceptNavigationDelegate* Get(content::WebContents* web_contents);
51
52 // Creates a InterceptNavigationResourceThrottle that will direct all
53 // callbacks to the InterceptNavigationDelegate.
54 static content::ResourceThrottle* CreateThrottleFor(
55 net::URLRequest* request);
56
57 virtual bool ShouldIgnoreNavigation(const GURL& url,
58 bool is_post,
59 bool has_user_gesture,
60 PageTransition transition_type);
61 private:
62 JavaObjectWeakGlobalRef weak_jdelegate_;
63 };
64
65 bool RegisterInterceptNavigationDelegate(JNIEnv* env);
66
67 } // namespace content
68
69 #endif // CONTENT_COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEG ATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698