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

Side by Side Diff: chrome/browser/component/navigation_interception/intercept_navigation_resource_throttle.h

Issue 11293017: Move navigation interception component to content/components (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add findbugs suppression for compatibility code. Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_RE SOURCE_THROTTLE_H_
6 #define CHROME_BROWSER_COMPONENT_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_RE SOURCE_THROTTLE_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/public/browser/resource_throttle.h"
13
14 class GURL;
15
16 namespace content {
17 class RenderViewHost;
18 struct Referrer;
19 }
20
21 namespace net {
22 class URLRequest;
23 }
24
25 namespace navigation_interception {
26
27 // This class allows the provider of the Callback to selectively ignore top
28 // level navigations.
29 class InterceptNavigationResourceThrottle : public content::ResourceThrottle {
30 public:
31 typedef base::Callback<bool(content::RenderViewHost* /* source */,
32 const GURL& /*url*/,
33 const content::Referrer& /*referrer*/,
34 bool /*has_user_gesture*/)>
35 CheckOnUIThreadCallback;
36
37 InterceptNavigationResourceThrottle(
38 net::URLRequest* request,
39 CheckOnUIThreadCallback should_ignore_callback);
40 virtual ~InterceptNavigationResourceThrottle();
41
42 // content::ResourceThrottle implementation:
43 virtual void WillStartRequest(bool* defer) OVERRIDE;
44 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE;
45
46 private:
47 bool CheckIfShouldIgnoreNavigation(const GURL& url);
48 void OnResultObtained(bool should_ignore_navigation);
49
50 net::URLRequest* request_;
51 CheckOnUIThreadCallback should_ignore_callback_;
52 base::WeakPtrFactory<InterceptNavigationResourceThrottle> weak_ptr_factory_;
53
54 DISALLOW_COPY_AND_ASSIGN(InterceptNavigationResourceThrottle);
55 };
56
57 } // namespace navigation_interception
58
59 #endif // CHROME_BROWSER_COMPONENT_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION _RESOURCE_THROTTLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698