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

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

Issue 6771043: Enabled actual transfer size in chromium (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
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 #pragma once 7 #pragma once
8 8
9 #include "webkit/glue/resource_loader_bridge.h" 9 #include "webkit/glue/resource_loader_bridge.h"
10 10
(...skipping 20 matching lines...) Expand all
31 // ResourceLoaderBridge::Peer methods. 31 // ResourceLoaderBridge::Peer methods.
32 virtual void OnUploadProgress(uint64 position, uint64 size); 32 virtual void OnUploadProgress(uint64 position, uint64 size);
33 virtual bool OnReceivedRedirect( 33 virtual bool OnReceivedRedirect(
34 const GURL& new_url, 34 const GURL& new_url,
35 const webkit_glue::ResourceResponseInfo& info, 35 const webkit_glue::ResourceResponseInfo& info,
36 bool* has_new_first_party_for_cookies, 36 bool* has_new_first_party_for_cookies,
37 GURL* new_first_party_for_cookies); 37 GURL* new_first_party_for_cookies);
38 virtual void OnReceivedResponse( 38 virtual void OnReceivedResponse(
39 const webkit_glue::ResourceResponseInfo& info); 39 const webkit_glue::ResourceResponseInfo& info);
40 virtual void OnDownloadedData(int len) {} 40 virtual void OnDownloadedData(int len) {}
41 virtual void OnReceivedData(const char* data, int len); 41 virtual void OnReceivedData(const char* data, int data_length,
pfeldman 2011/04/01 08:48:06 nit: one parameter per line.
vsevik 2011/04/01 09:50:59 Done.
42 int length_received);
42 virtual void OnCompletedRequest(const net::URLRequestStatus& status, 43 virtual void OnCompletedRequest(const net::URLRequestStatus& status,
43 const std::string& security_info, 44 const std::string& security_info,
44 const base::Time& completion_time); 45 const base::Time& completion_time);
45 46
46 protected: 47 protected:
47 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 48 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge,
48 webkit_glue::ResourceLoaderBridge::Peer* peer); 49 webkit_glue::ResourceLoaderBridge::Peer* peer);
49 50
50 webkit_glue::ResourceLoaderBridge::Peer* original_peer_; 51 webkit_glue::ResourceLoaderBridge::Peer* original_peer_;
51 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_; 52 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_;
52 53
53 private: 54 private:
54 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); 55 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer);
55 }; 56 };
56 57
57 // The BufferedPeer reads all the data of the request into an internal buffer. 58 // The BufferedPeer reads all the data of the request into an internal buffer.
58 // Subclasses should implement DataReady() to process the data as necessary. 59 // Subclasses should implement DataReady() to process the data as necessary.
59 class BufferedPeer : public SecurityFilterPeer { 60 class BufferedPeer : public SecurityFilterPeer {
60 public: 61 public:
61 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 62 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge,
62 webkit_glue::ResourceLoaderBridge::Peer* peer, 63 webkit_glue::ResourceLoaderBridge::Peer* peer,
63 const std::string& mime_type); 64 const std::string& mime_type);
64 virtual ~BufferedPeer(); 65 virtual ~BufferedPeer();
65 66
66 // ResourceLoaderBridge::Peer Implementation. 67 // ResourceLoaderBridge::Peer Implementation.
67 virtual void OnReceivedResponse( 68 virtual void OnReceivedResponse(
68 const webkit_glue::ResourceResponseInfo& info); 69 const webkit_glue::ResourceResponseInfo& info);
69 virtual void OnReceivedData(const char* data, int len); 70 virtual void OnReceivedData(const char* data, int data_length,
pfeldman 2011/04/01 08:48:06 ditto
vsevik 2011/04/01 09:50:59 Done.
71 int length_received);
70 virtual void OnCompletedRequest(const net::URLRequestStatus& status, 72 virtual void OnCompletedRequest(const net::URLRequestStatus& status,
71 const std::string& security_info, 73 const std::string& security_info,
72 const base::Time& completion_time); 74 const base::Time& completion_time);
73 75
74 protected: 76 protected:
75 // Invoked when the entire request has been processed before the data is sent 77 // Invoked when the entire request has been processed before the data is sent
76 // to the original peer, giving an opportunity to subclasses to process the 78 // to the original peer, giving an opportunity to subclasses to process the
77 // data in data_. If this method returns true, the data is fed to the 79 // data in data_. If this method returns true, the data is fed to the
78 // original peer, if it returns false, an error is sent instead. 80 // original peer, if it returns false, an error is sent instead.
79 virtual bool DataReady() = 0; 81 virtual bool DataReady() = 0;
80 82
81 webkit_glue::ResourceResponseInfo response_info_; 83 webkit_glue::ResourceResponseInfo response_info_;
82 std::string data_; 84 std::string data_;
83 85
pfeldman 2011/04/01 08:48:06 Remove this new line.
vsevik 2011/04/01 09:50:59 Done.
86
84 private: 87 private:
85 std::string mime_type_; 88 std::string mime_type_;
86 89
87 DISALLOW_COPY_AND_ASSIGN(BufferedPeer); 90 DISALLOW_COPY_AND_ASSIGN(BufferedPeer);
88 }; 91 };
89 92
90 // The ReplaceContentPeer cancels the request and serves the provided data as 93 // The ReplaceContentPeer cancels the request and serves the provided data as
91 // content instead. 94 // content instead.
92 // TODO(jcampan): we do not as of now cancel the request, as we do not have 95 // TODO(jcampan): we do not as of now cancel the request, as we do not have
93 // access to the resource_loader_bridge in the SecurityFilterPeer factory 96 // access to the resource_loader_bridge in the SecurityFilterPeer factory
94 // method. For now the resource is still being fetched, but ignored, as once 97 // method. For now the resource is still being fetched, but ignored, as once
95 // we have provided the replacement content, the associated pending request 98 // we have provided the replacement content, the associated pending request
96 // in ResourceDispatcher is removed and further OnReceived* notifications are 99 // in ResourceDispatcher is removed and further OnReceived* notifications are
97 // ignored. 100 // ignored.
98 class ReplaceContentPeer : public SecurityFilterPeer { 101 class ReplaceContentPeer : public SecurityFilterPeer {
99 public: 102 public:
100 ReplaceContentPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, 103 ReplaceContentPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge,
101 webkit_glue::ResourceLoaderBridge::Peer* peer, 104 webkit_glue::ResourceLoaderBridge::Peer* peer,
102 const std::string& mime_type, 105 const std::string& mime_type,
103 const std::string& data); 106 const std::string& data);
104 virtual ~ReplaceContentPeer(); 107 virtual ~ReplaceContentPeer();
105 108
106 // ResourceLoaderBridge::Peer Implementation. 109 // ResourceLoaderBridge::Peer Implementation.
107 virtual void OnReceivedResponse( 110 virtual void OnReceivedResponse(
108 const webkit_glue::ResourceResponseInfo& info); 111 const webkit_glue::ResourceResponseInfo& info);
109 virtual void OnReceivedData(const char* data, int len); 112 virtual void OnReceivedData(const char* data, int data_length,
pfeldman 2011/04/01 08:48:06 ditto
vsevik 2011/04/01 09:50:59 Done.
113 int length_received);
110 virtual void OnCompletedRequest(const net::URLRequestStatus& status, 114 virtual void OnCompletedRequest(const net::URLRequestStatus& status,
111 const std::string& security_info, 115 const std::string& security_info,
112 const base::Time& completion_time); 116 const base::Time& completion_time);
113 117
114 private: 118 private:
115 webkit_glue::ResourceResponseInfo response_info_; 119 webkit_glue::ResourceResponseInfo response_info_;
116 std::string mime_type_; 120 std::string mime_type_;
117 std::string data_; 121 std::string data_;
118 122
119 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); 123 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer);
120 }; 124 };
121 125
122 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ 126 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698