Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 CHROME_BROWSER_COMPONENT_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DE LEGATE_H_ | |
| 6 #define CHROME_BROWSER_COMPONENT_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DE LEGATE_H_ | |
| 7 | |
| 8 #include "base/android/jni_helper.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/supports_user_data.h" | |
| 11 | |
| 12 class GURL; | |
| 13 | |
| 14 namespace content { | |
| 15 class ResourceThrottle; | |
| 16 class WebContents; | |
| 17 } | |
| 18 | |
| 19 namespace net { | |
| 20 class URLRequest; | |
| 21 } | |
| 22 | |
| 23 namespace navigation_interception { | |
| 24 | |
| 25 class InterceptNavigationDelegate : public base::SupportsUserData::Data { | |
|
joth
2012/10/03 22:01:32
class comment? (mainly need to point out how to us
mkosiba (inactive)
2012/10/08 15:09:12
Done.
| |
| 26 public: | |
| 27 InterceptNavigationDelegate(JNIEnv* env, jobject jdelegate); | |
| 28 virtual ~InterceptNavigationDelegate(); | |
| 29 | |
| 30 // Associates the InterceptNavigationDelegate with a WebContents using the | |
| 31 // SupportsUserData mechanism. | |
| 32 static void Associate(content::WebContents* web_contents, | |
| 33 scoped_ptr<InterceptNavigationDelegate> delegate); | |
| 34 // Gets the InterceptNavigationDelegate associated with the WebContents, | |
| 35 // can be null. | |
| 36 static InterceptNavigationDelegate* Get(content::WebContents* web_contents); | |
| 37 | |
| 38 // Creates a InterceptNavigationResourceThrottle that will direct all | |
| 39 // callbacks to the InterceptNavigationDelegate. | |
| 40 static content::ResourceThrottle* CreateThrottleFor( | |
| 41 net::URLRequest* request); | |
| 42 | |
| 43 virtual bool ShouldIgnoreNavigation(const GURL& url, | |
| 44 bool has_user_gesture); | |
| 45 private: | |
| 46 JavaObjectWeakGlobalRef weak_jdelegate_; | |
| 47 }; | |
| 48 | |
| 49 bool RegisterInterceptNavigationDelegate(JNIEnv* env); | |
| 50 | |
| 51 } // namespace navigation_interception | |
| 52 | |
| 53 #endif // CHROME_BROWSER_COMPONENT_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION _DELEGATE_H_ | |
| OLD | NEW |