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

Side by Side Diff: chrome/browser/renderer_host/intercept_navigation_resource_throttle.h

Issue 10310124: Implement a ResourceThrottle for URL overriding in Chrome on Android. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix build (Referrer is a struct, not a class) Created 8 years, 6 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 unified diff | Download patch
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_RENDERER_HOST_INTERCEPT_NAVIGATION_RESOURCE_THROTTLE_H_
6 #define CHROME_BROWSER_RENDERER_HOST_INTERCEPT_NAVIGATION_RESOURCE_THROTTLE_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/memory/weak_ptr.h"
13 #include "content/public/browser/resource_throttle.h"
14
15 class GURL;
16
17 namespace content {
18 class RenderViewHost;
19 struct Referrer;
20 }
21
22 namespace net {
23 class URLRequest;
24 }
25
26 // This class allows the provider of the Callback to selectively ignore top
27 // level navigations.
28 class InterceptNavigationResourceThrottle : public content::ResourceThrottle {
29 public:
30 typedef base::Callback<bool(content::RenderViewHost* /* source */,
31 const GURL& /*url*/,
32 const content::Referrer& /*referrer*/,
33 bool /*is_content_initiated*/)>
34 CheckOnUIThreadCallback;
35
36 InterceptNavigationResourceThrottle(
37 net::URLRequest* request,
38 CheckOnUIThreadCallback should_ignore_callback);
39 virtual ~InterceptNavigationResourceThrottle();
40
41 // content::ResourceThrottle implementation:
42 virtual void WillStartRequest(bool* defer) OVERRIDE;
43 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE;
44
45 private:
46 bool CheckIfShouldIgnoreNavigation(const GURL& url);
47 void OnResultObtained(bool should_ignore_navigation);
48
49 net::URLRequest* request_;
50 CheckOnUIThreadCallback should_ignore_callback_;
51 base::WeakPtrFactory<InterceptNavigationResourceThrottle> weak_ptr_factory_;
52
53 DISALLOW_COPY_AND_ASSIGN(InterceptNavigationResourceThrottle);
54 };
55
56 #endif // CHROME_BROWSER_RENDERER_HOST_INTERCEPT_NAVIGATION_RESOURCE_THROTTLE_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698