Chromium Code Reviews| Index: chrome/browser/component/navigation_interception/intercept_navigation_delegate.h |
| diff --git a/chrome/browser/component/navigation_interception/intercept_navigation_delegate.h b/chrome/browser/component/navigation_interception/intercept_navigation_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a91cf6111dd2e128f58686294793af7a4038dfd7 |
| --- /dev/null |
| +++ b/chrome/browser/component/navigation_interception/intercept_navigation_delegate.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_COMPONENT_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ |
| +#define CHROME_BROWSER_COMPONENT_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ |
| + |
| +#include "base/android/jni_helper.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/supports_user_data.h" |
| + |
| +class GURL; |
| + |
| +namespace content { |
| +class ResourceThrottle; |
| +class WebContents; |
| +} |
| + |
| +namespace net { |
| +class URLRequest; |
| +} |
| + |
| +namespace navigation_interception { |
| + |
| +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.
|
| + public: |
| + InterceptNavigationDelegate(JNIEnv* env, jobject jdelegate); |
| + virtual ~InterceptNavigationDelegate(); |
| + |
| + // Associates the InterceptNavigationDelegate with a WebContents using the |
| + // SupportsUserData mechanism. |
| + static void Associate(content::WebContents* web_contents, |
| + scoped_ptr<InterceptNavigationDelegate> delegate); |
| + // Gets the InterceptNavigationDelegate associated with the WebContents, |
| + // can be null. |
| + static InterceptNavigationDelegate* Get(content::WebContents* web_contents); |
| + |
| + // Creates a InterceptNavigationResourceThrottle that will direct all |
| + // callbacks to the InterceptNavigationDelegate. |
| + static content::ResourceThrottle* CreateThrottleFor( |
| + net::URLRequest* request); |
| + |
| + virtual bool ShouldIgnoreNavigation(const GURL& url, |
| + bool has_user_gesture); |
| + private: |
| + JavaObjectWeakGlobalRef weak_jdelegate_; |
| +}; |
| + |
| +bool RegisterInterceptNavigationDelegate(JNIEnv* env); |
| + |
| +} // namespace navigation_interception |
| + |
| +#endif // CHROME_BROWSER_COMPONENT_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_DELEGATE_H_ |