| OLD | NEW |
| 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 #ifndef CONTENT_COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE
_H_ | 5 #ifndef COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ |
| 6 #define CONTENT_COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE
_H_ | 6 #define COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_helper.h" | 8 #include "base/android/jni_helper.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| 11 #include "content/public/common/page_transition_types.h" | 11 #include "content/public/common/page_transition_types.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 class ResourceThrottle; | 16 class ResourceThrottle; |
| 17 class WebContents; | 17 class WebContents; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class URLRequest; | 21 class URLRequest; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace content { | 24 namespace components { |
| 25 | 25 |
| 26 // Native side of the InterceptNavigationDelegate Java interface. | 26 // Native side of the InterceptNavigationDelegate Java interface. |
| 27 // This is used to create a InterceptNavigationResourceThrottle that calls the | 27 // This is used to create a InterceptNavigationResourceThrottle that calls the |
| 28 // Java interface method to determine whether a navigation should be ignored or | 28 // Java interface method to determine whether a navigation should be ignored or |
| 29 // not. | 29 // not. |
| 30 // To us this class: | 30 // To us this class: |
| 31 // 1) the Java-side interface implementation must be associated (via the | 31 // 1) the Java-side interface implementation must be associated (via the |
| 32 // Associate method) with a WebContents for which URLRequests are to be | 32 // Associate method) with a WebContents for which URLRequests are to be |
| 33 // intercepted, | 33 // intercepted, |
| 34 // 2) the ResourceThrottle obtained via CreateThrottleFor must be associated | 34 // 2) the ResourceThrottle obtained via CreateThrottleFor must be associated |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 static InterceptNavigationDelegate* Get(content::WebContents* web_contents); | 50 static InterceptNavigationDelegate* Get(content::WebContents* web_contents); |
| 51 | 51 |
| 52 // Creates a InterceptNavigationResourceThrottle that will direct all | 52 // Creates a InterceptNavigationResourceThrottle that will direct all |
| 53 // callbacks to the InterceptNavigationDelegate. | 53 // callbacks to the InterceptNavigationDelegate. |
| 54 static content::ResourceThrottle* CreateThrottleFor( | 54 static content::ResourceThrottle* CreateThrottleFor( |
| 55 net::URLRequest* request); | 55 net::URLRequest* request); |
| 56 | 56 |
| 57 virtual bool ShouldIgnoreNavigation(const GURL& url, | 57 virtual bool ShouldIgnoreNavigation(const GURL& url, |
| 58 bool is_post, | 58 bool is_post, |
| 59 bool has_user_gesture, | 59 bool has_user_gesture, |
| 60 PageTransition transition_type); | 60 content::PageTransition transition_type); |
| 61 private: | 61 private: |
| 62 JavaObjectWeakGlobalRef weak_jdelegate_; | 62 JavaObjectWeakGlobalRef weak_jdelegate_; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 bool RegisterInterceptNavigationDelegate(JNIEnv* env); | 65 bool RegisterInterceptNavigationDelegate(JNIEnv* env); |
| 66 | 66 |
| 67 } // namespace content | 67 } // namespace components |
| 68 | 68 |
| 69 #endif // CONTENT_COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEG
ATE_H_ | 69 #endif // COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ |
| OLD | NEW |