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_IGNORE_NAVIGATION_RESOURCE_THROTTLE_H_ | |
| 6 #define CHROME_BROWSER_RENDERER_HOST_IGNORE_NAVIGATION_RESOURCE_THROTTLE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "content/public/browser/resource_throttle.h" | |
| 13 | |
| 14 namespace net { | |
| 15 class URLRequest; | |
| 16 } // namespace net | |
| 17 | |
| 18 // This class allows the embedder (via WebContentsDelegate) to selectively | |
| 19 // ignore top level navigations. | |
| 20 class IgnoreNavigationResourceThrottle | |
|
darin (slow to review)
2012/05/23 18:18:29
nit: this class name suggests unconditional ignori
mkosiba (inactive)
2012/05/28 16:06:52
Done.
| |
| 21 : public content::ResourceThrottle { | |
| 22 public: | |
| 23 explicit IgnoreNavigationResourceThrottle(net::URLRequest* request); | |
| 24 virtual ~IgnoreNavigationResourceThrottle(); | |
| 25 | |
| 26 // content::ResourceThrottle implementation: | |
| 27 virtual void WillStartRequest(bool* defer) OVERRIDE; | |
| 28 virtual void WillRedirectRequest(const GURL& new_url, bool* defer) OVERRIDE; | |
| 29 | |
| 30 private: | |
| 31 bool ShouldDeferRequestForUrl(const GURL& url); | |
| 32 void OnResultObtained(bool should_ignore_navigation); | |
| 33 | |
| 34 net::URLRequest* request_; | |
| 35 base::WeakPtrFactory<IgnoreNavigationResourceThrottle> | |
| 36 weak_ptr_factory_; | |
| 37 | |
| 38 DISALLOW_COPY_AND_ASSIGN(IgnoreNavigationResourceThrottle); | |
| 39 }; | |
| 40 | |
| 41 #endif // CHROME_BROWSER_RENDERER_HOST_IGNORE_NAVIGATION_RESOURCE_THROTTLE_H_ | |
| OLD | NEW |