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

Unified Diff: chrome/browser/component/navigation_interception/intercept_navigation_delegate.h

Issue 10946008: Componentize IgnoreNavigationResourceThrottle and add chrome and webview specific implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved jni to component, added Java test code 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698