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

Side by Side Diff: chrome/renderer/security_filter_peer.h

Issue 1103813002: Make WebURLLoader capable of retaining received buffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
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"
(...skipping 17 matching lines...) Expand all
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 void OnUploadProgress(uint64 position, uint64 size) override; 33 void OnUploadProgress(uint64 position, uint64 size) override;
34 bool OnReceivedRedirect(const net::RedirectInfo& redirect_info, 34 bool OnReceivedRedirect(const net::RedirectInfo& redirect_info,
35 const content::ResourceResponseInfo& info) override; 35 const content::ResourceResponseInfo& info) override;
36 void OnReceivedResponse(const content::ResourceResponseInfo& info) override; 36 void OnReceivedResponse(const content::ResourceResponseInfo& info) override;
37 void OnDownloadedData(int len, int encoded_data_length) override {} 37 void OnDownloadedData(int len, int encoded_data_length) override {}
38 void OnReceivedData(const char* data, 38 void OnReceivedData(scoped_ptr<ReceivedData> data) override;
39 int data_length,
40 int encoded_data_length) override;
41 void OnCompletedRequest(int error_code, 39 void OnCompletedRequest(int error_code,
42 bool was_ignored_by_handler, 40 bool was_ignored_by_handler,
43 bool stale_copy_in_cache, 41 bool stale_copy_in_cache,
44 const std::string& security_info, 42 const std::string& security_info,
45 const base::TimeTicks& completion_time, 43 const base::TimeTicks& completion_time,
46 int64 total_transfer_size) override; 44 int64 total_transfer_size) override;
47 45
48 protected: 46 protected:
49 explicit SecurityFilterPeer(content::RequestPeer* peer); 47 explicit SecurityFilterPeer(content::RequestPeer* peer);
50 48
51 content::RequestPeer* original_peer_; 49 content::RequestPeer* original_peer_;
52 50
53 private: 51 private:
54 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); 52 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer);
55 }; 53 };
56 54
57 // The BufferedPeer reads all the data of the request into an internal buffer. 55 // The BufferedPeer reads all the data of the request into an internal buffer.
58 // Subclasses should implement DataReady() to process the data as necessary. 56 // Subclasses should implement DataReady() to process the data as necessary.
59 class BufferedPeer : public SecurityFilterPeer { 57 class BufferedPeer : public SecurityFilterPeer {
60 public: 58 public:
61 BufferedPeer(content::RequestPeer* peer, const std::string& mime_type); 59 BufferedPeer(content::RequestPeer* peer, const std::string& mime_type);
62 ~BufferedPeer() override; 60 ~BufferedPeer() override;
63 61
64 // content::RequestPeer Implementation. 62 // content::RequestPeer Implementation.
65 void OnReceivedResponse(const content::ResourceResponseInfo& info) override; 63 void OnReceivedResponse(const content::ResourceResponseInfo& info) override;
66 void OnReceivedData(const char* data, 64 void OnReceivedData(scoped_ptr<ReceivedData> data) override;
67 int data_length,
68 int encoded_data_length) override;
69 void OnCompletedRequest(int error_code, 65 void OnCompletedRequest(int error_code,
70 bool was_ignored_by_handler, 66 bool was_ignored_by_handler,
71 bool stale_copy_in_cache, 67 bool stale_copy_in_cache,
72 const std::string& security_info, 68 const std::string& security_info,
73 const base::TimeTicks& completion_time, 69 const base::TimeTicks& completion_time,
74 int64 total_transfer_size) override; 70 int64 total_transfer_size) override;
75 71
76 protected: 72 protected:
77 // Invoked when the entire request has been processed before the data is sent 73 // Invoked when the entire request has been processed before the data is sent
78 // to the original peer, giving an opportunity to subclasses to process the 74 // to the original peer, giving an opportunity to subclasses to process the
(...skipping 18 matching lines...) Expand all
97 // ignored. 93 // ignored.
98 class ReplaceContentPeer : public SecurityFilterPeer { 94 class ReplaceContentPeer : public SecurityFilterPeer {
99 public: 95 public:
100 ReplaceContentPeer(content::RequestPeer* peer, 96 ReplaceContentPeer(content::RequestPeer* peer,
101 const std::string& mime_type, 97 const std::string& mime_type,
102 const std::string& data); 98 const std::string& data);
103 ~ReplaceContentPeer() override; 99 ~ReplaceContentPeer() override;
104 100
105 // content::RequestPeer Implementation. 101 // content::RequestPeer Implementation.
106 void OnReceivedResponse(const content::ResourceResponseInfo& info) override; 102 void OnReceivedResponse(const content::ResourceResponseInfo& info) override;
107 void OnReceivedData(const char* data, 103 void OnReceivedData(scoped_ptr<ReceivedData> data) override;
108 int data_length,
109 int encoded_data_length) override;
110 void OnCompletedRequest(int error_code, 104 void OnCompletedRequest(int error_code,
111 bool was_ignored_by_handler, 105 bool was_ignored_by_handler,
112 bool stale_copy_in_cache, 106 bool stale_copy_in_cache,
113 const std::string& security_info, 107 const std::string& security_info,
114 const base::TimeTicks& completion_time, 108 const base::TimeTicks& completion_time,
115 int64 total_transfer_size) override; 109 int64 total_transfer_size) override;
116 110
117 private: 111 private:
118 content::ResourceResponseInfo response_info_; 112 content::ResourceResponseInfo response_info_;
119 std::string mime_type_; 113 std::string mime_type_;
120 std::string data_; 114 std::string data_;
121 115
122 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); 116 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer);
123 }; 117 };
124 118
125 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ 119 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698