OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_RENDERER_SECURITY_FILTER_PEER_H_ | 5 #ifndef CHROME_RENDERER_SECURITY_FILTER_PEER_H_ |
6 #define CHROME_RENDERER_SECURITY_FILTER_PEER_H_ | 6 #define CHROME_RENDERER_SECURITY_FILTER_PEER_H_ |
7 | 7 |
8 #include "content/public/child/request_peer.h" | 8 #include "content/public/child/request_peer.h" |
9 #include "content/public/common/resource_response_info.h" | 9 #include "content/public/common/resource_response_info.h" |
10 #include "content/public/common/resource_type.h" | 10 #include "content/public/common/resource_type.h" |
11 | 11 |
12 // The SecurityFilterPeer is a proxy to a | 12 // The SecurityFilterPeer is a proxy to a |
13 // content::RequestPeer instance. It is used to pre-process | 13 // content::RequestPeer instance. It is used to pre-process |
14 // unsafe resources (such as mixed-content resource). | 14 // unsafe resources (such as mixed-content resource). |
15 // Call the factory method CreateSecurityFilterPeer() to obtain an instance of | 15 // Call the factory method CreateSecurityFilterPeer() to obtain an instance of |
16 // SecurityFilterPeer based on the original Peer. | 16 // SecurityFilterPeer based on the original Peer. |
17 // NOTE: subclasses should insure they delete themselves at the end of the | 17 // NOTE: subclasses should ensure they delete themselves at the end of the |
18 // OnReceiveComplete call. | 18 // OnReceiveComplete call. |
19 class SecurityFilterPeer : public content::RequestPeer { | 19 class SecurityFilterPeer : public content::RequestPeer { |
20 public: | 20 public: |
21 virtual ~SecurityFilterPeer(); | 21 virtual ~SecurityFilterPeer(); |
22 | 22 |
23 static SecurityFilterPeer* CreateSecurityFilterPeerForDeniedRequest( | 23 static SecurityFilterPeer* CreateSecurityFilterPeerForDeniedRequest( |
24 content::ResourceType resource_type, | 24 content::ResourceType resource_type, |
25 content::RequestPeer* peer, | 25 content::RequestPeer* peer, |
26 int os_error); | 26 int os_error); |
27 | 27 |
28 static SecurityFilterPeer* CreateSecurityFilterPeerForFrame( | 28 static SecurityFilterPeer* CreateSecurityFilterPeerForFrame( |
29 content::RequestPeer* peer, | 29 content::RequestPeer* peer, |
30 int os_error); | 30 int os_error); |
31 | 31 |
32 // content::RequestPeer methods. | 32 // content::RequestPeer methods. |
33 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; | 33 virtual void OnUploadProgress(uint64 position, uint64 size) OVERRIDE; |
34 virtual bool OnReceivedRedirect( | 34 virtual bool OnReceivedRedirect( |
35 const GURL& new_url, | 35 const net::RedirectInfo& redirect_info, |
36 const GURL& new_first_party_for_cookies, | |
37 const content::ResourceResponseInfo& info) OVERRIDE; | 36 const content::ResourceResponseInfo& info) OVERRIDE; |
38 virtual void OnReceivedResponse( | 37 virtual void OnReceivedResponse( |
39 const content::ResourceResponseInfo& info) OVERRIDE; | 38 const content::ResourceResponseInfo& info) OVERRIDE; |
40 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {} | 39 virtual void OnDownloadedData(int len, int encoded_data_length) OVERRIDE {} |
41 virtual void OnReceivedData(const char* data, | 40 virtual void OnReceivedData(const char* data, |
42 int data_length, | 41 int data_length, |
43 int encoded_data_length) OVERRIDE; | 42 int encoded_data_length) OVERRIDE; |
44 virtual void OnCompletedRequest(int error_code, | 43 virtual void OnCompletedRequest(int error_code, |
45 bool was_ignored_by_handler, | 44 bool was_ignored_by_handler, |
46 bool stale_copy_in_cache, | 45 bool stale_copy_in_cache, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 122 |
124 private: | 123 private: |
125 content::ResourceResponseInfo response_info_; | 124 content::ResourceResponseInfo response_info_; |
126 std::string mime_type_; | 125 std::string mime_type_; |
127 std::string data_; | 126 std::string data_; |
128 | 127 |
129 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); | 128 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); |
130 }; | 129 }; |
131 | 130 |
132 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ | 131 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ |
OLD | NEW |