Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 WebContents; | |
|
darin (slow to review)
2012/06/15 19:52:55
usually code in renderer_host does not see WebCont
mkosiba (inactive)
2012/06/18 10:47:06
Done.
| |
| 19 class Referrer; | |
| 20 } // namespace content | |
| 21 | |
| 22 namespace net { | |
| 23 class URLRequest; | |
| 24 } // namespace net | |
| 25 | |
| 26 // This class allows the embedder (via WebContentsDelegate) to selectively | |
|
darin (slow to review)
2012/06/15 19:52:55
this comment seems wrong now.
mkosiba (inactive)
2012/06/18 10:47:06
Done.
| |
| 27 // ignore top level navigations. | |
| 28 class InterceptNavigationResourceThrottle : public content::ResourceThrottle { | |
| 29 public: | |
| 30 typedef base::Callback<bool(content::WebContents* /* source */, | |
| 31 const GURL& /*url*/, | |
| 32 const content::Referrer& /*referrer*/, | |
| 33 bool /*is_content_initiated*/)> | |
| 34 CheckOnUIThreadCallback; | |
| 35 InterceptNavigationResourceThrottle( | |
| 36 net::URLRequest* request, | |
| 37 CheckOnUIThreadCallback should_ignore_callback); | |
| 38 virtual ~InterceptNavigationResourceThrottle(); | |
| 39 | |
| 40 // content::ResourceThrottle implementation: | |
| 41 virtual void WillStartRequest(bool* defer) OVERRIDE; | |
| 42 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; | |
| 43 | |
| 44 private: | |
| 45 bool ShouldDeferRequestForURL(const GURL& url); | |
| 46 void OnResultObtained(bool should_ignore_navigation); | |
| 47 | |
| 48 net::URLRequest* request_; | |
| 49 CheckOnUIThreadCallback should_ignore_callback_; | |
| 50 base::WeakPtrFactory<InterceptNavigationResourceThrottle> | |
| 51 weak_ptr_factory_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(InterceptNavigationResourceThrottle); | |
| 54 }; | |
| 55 | |
| 56 #endif // CHROME_BROWSER_RENDERER_HOST_INTERCEPT_NAVIGATION_RESOURCE_THROTTLE_H _ | |
| OLD | NEW |