OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/browser/loader/layered_resource_handler.h" | 10 #include "content/browser/loader/layered_resource_handler.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // AsyncEventHandler, and it sits inside SafeBrowsing and Buffered event | 22 // AsyncEventHandler, and it sits inside SafeBrowsing and Buffered event |
23 // handlers. This is important, so that it can intercept OnResponseStarted | 23 // handlers. This is important, so that it can intercept OnResponseStarted |
24 // after we determine that a response is safe and not a download. | 24 // after we determine that a response is safe and not a download. |
25 class CrossSiteResourceHandler : public LayeredResourceHandler { | 25 class CrossSiteResourceHandler : public LayeredResourceHandler { |
26 public: | 26 public: |
27 CrossSiteResourceHandler(scoped_ptr<ResourceHandler> next_handler, | 27 CrossSiteResourceHandler(scoped_ptr<ResourceHandler> next_handler, |
28 net::URLRequest* request); | 28 net::URLRequest* request); |
29 virtual ~CrossSiteResourceHandler(); | 29 virtual ~CrossSiteResourceHandler(); |
30 | 30 |
31 // ResourceHandler implementation: | 31 // ResourceHandler implementation: |
32 virtual bool OnRequestRedirected(const GURL& new_url, | 32 virtual bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
33 ResourceResponse* response, | 33 ResourceResponse* response, |
34 bool* defer) OVERRIDE; | 34 bool* defer) OVERRIDE; |
35 virtual bool OnResponseStarted(ResourceResponse* response, | 35 virtual bool OnResponseStarted(ResourceResponse* response, |
36 bool* defer) OVERRIDE; | 36 bool* defer) OVERRIDE; |
37 virtual bool OnReadCompleted(int bytes_read, | 37 virtual bool OnReadCompleted(int bytes_read, |
38 bool* defer) OVERRIDE; | 38 bool* defer) OVERRIDE; |
39 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 39 virtual void OnResponseCompleted(const net::URLRequestStatus& status, |
40 const std::string& security_info, | 40 const std::string& security_info, |
41 bool* defer) OVERRIDE; | 41 bool* defer) OVERRIDE; |
42 | 42 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // PostTaskAndReplyWithResult. If a transfer is needed, it goes back to the UI | 95 // PostTaskAndReplyWithResult. If a transfer is needed, it goes back to the UI |
96 // thread. This can be removed once the code is changed to only do one hop. | 96 // thread. This can be removed once the code is changed to only do one hop. |
97 base::WeakPtrFactory<CrossSiteResourceHandler> weak_ptr_factory_; | 97 base::WeakPtrFactory<CrossSiteResourceHandler> weak_ptr_factory_; |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); | 99 DISALLOW_COPY_AND_ASSIGN(CrossSiteResourceHandler); |
100 }; | 100 }; |
101 | 101 |
102 } // namespace content | 102 } // namespace content |
103 | 103 |
104 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ | 104 #endif // CONTENT_BROWSER_LOADER_CROSS_SITE_RESOURCE_HANDLER_H_ |
OLD | NEW |