summaryrefslogtreecommitdiffstats
path: root/components/navigation_interception/intercept_navigation_resource_throttle.h
diff options
context:
space:
mode:
authorkaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-23 03:55:16 +0000
committerkaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-23 03:55:16 +0000
commit62885abfdaced9bad3f119e5f4f15b81f34c02c6 (patch)
tree97eba6bb62094c692561f9355d037a392e72e54f /components/navigation_interception/intercept_navigation_resource_throttle.h
parent62c607121a2c0b5bf463cd6da0fd568140523e30 (diff)
downloadchromium_src-62885abfdaced9bad3f119e5f4f15b81f34c02c6.zip
chromium_src-62885abfdaced9bad3f119e5f4f15b81f34c02c6.tar.gz
chromium_src-62885abfdaced9bad3f119e5f4f15b81f34c02c6.tar.bz2
Move content/components/navigation_interception to src/components
BUG=169312 Review URL: https://chromiumcodereview.appspot.com/11830043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/navigation_interception/intercept_navigation_resource_throttle.h')
-rw-r--r--components/navigation_interception/intercept_navigation_resource_throttle.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/components/navigation_interception/intercept_navigation_resource_throttle.h b/components/navigation_interception/intercept_navigation_resource_throttle.h
new file mode 100644
index 0000000..7bfe6fa
--- /dev/null
+++ b/components/navigation_interception/intercept_navigation_resource_throttle.h
@@ -0,0 +1,63 @@
+// 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 COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_RESOURCE_THROTTLE_H_
+#define COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_RESOURCE_THROTTLE_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/resource_throttle.h"
+#include "content/public/common/page_transition_types.h"
+
+class GURL;
+
+namespace content {
+class RenderViewHost;
+struct Referrer;
+}
+
+namespace net {
+class URLRequest;
+}
+
+namespace components {
+
+// This class allows the provider of the Callback to selectively ignore top
+// level navigations.
+class InterceptNavigationResourceThrottle : public content::ResourceThrottle {
+ public:
+ typedef base::Callback<
+ bool(content::RenderViewHost* /* source */,
+ const GURL& /* url */,
+ const content::Referrer& /*referrer*/,
+ bool /* is_post */,
+ bool /* has_user_gesture */,
+ content::PageTransition /* page transition type */)>
+ CheckOnUIThreadCallback;
+
+ InterceptNavigationResourceThrottle(
+ net::URLRequest* request,
+ CheckOnUIThreadCallback should_ignore_callback);
+ virtual ~InterceptNavigationResourceThrottle();
+
+ // content::ResourceThrottle implementation:
+ virtual void WillStartRequest(bool* defer) OVERRIDE;
+ virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE;
+
+ private:
+ bool CheckIfShouldIgnoreNavigation(const GURL& url);
+ void OnResultObtained(bool should_ignore_navigation);
+
+ net::URLRequest* request_;
+ CheckOnUIThreadCallback should_ignore_callback_;
+ base::WeakPtrFactory<InterceptNavigationResourceThrottle> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(InterceptNavigationResourceThrottle);
+};
+
+} // namespace components
+
+#endif // COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_RESOURCE_THROTTLE_H_