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 #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 23 matching lines...) Expand all Loading... |
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) OVERRIDE; | 37 GURL* new_first_party_for_cookies) OVERRIDE; |
38 virtual void OnReceivedResponse( | 38 virtual void OnReceivedResponse( |
39 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; | 39 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; |
40 virtual void OnDownloadedData(int len) OVERRIDE {} | 40 virtual void OnDownloadedData(int len) OVERRIDE {} |
41 virtual void OnReceivedData(const char* data, | 41 virtual void OnReceivedData(const char* data, |
42 int data_length, | 42 int data_length, |
43 int encoded_data_length) OVERRIDE; | 43 int encoded_data_length) OVERRIDE; |
44 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 44 virtual void OnCompletedRequest( |
45 const std::string& security_info, | 45 const net::URLRequestStatus& status, |
46 const base::Time& completion_time) OVERRIDE; | 46 const std::string& security_info, |
| 47 const base::TimeTicks& completion_time) OVERRIDE; |
47 | 48 |
48 protected: | 49 protected: |
49 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, | 50 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, |
50 webkit_glue::ResourceLoaderBridge::Peer* peer); | 51 webkit_glue::ResourceLoaderBridge::Peer* peer); |
51 | 52 |
52 webkit_glue::ResourceLoaderBridge::Peer* original_peer_; | 53 webkit_glue::ResourceLoaderBridge::Peer* original_peer_; |
53 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_; | 54 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_; |
54 | 55 |
55 private: | 56 private: |
56 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); | 57 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); |
57 }; | 58 }; |
58 | 59 |
59 // The BufferedPeer reads all the data of the request into an internal buffer. | 60 // The BufferedPeer reads all the data of the request into an internal buffer. |
60 // Subclasses should implement DataReady() to process the data as necessary. | 61 // Subclasses should implement DataReady() to process the data as necessary. |
61 class BufferedPeer : public SecurityFilterPeer { | 62 class BufferedPeer : public SecurityFilterPeer { |
62 public: | 63 public: |
63 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, | 64 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, |
64 webkit_glue::ResourceLoaderBridge::Peer* peer, | 65 webkit_glue::ResourceLoaderBridge::Peer* peer, |
65 const std::string& mime_type); | 66 const std::string& mime_type); |
66 virtual ~BufferedPeer(); | 67 virtual ~BufferedPeer(); |
67 | 68 |
68 // ResourceLoaderBridge::Peer Implementation. | 69 // ResourceLoaderBridge::Peer Implementation. |
69 virtual void OnReceivedResponse( | 70 virtual void OnReceivedResponse( |
70 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; | 71 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; |
71 virtual void OnReceivedData(const char* data, | 72 virtual void OnReceivedData(const char* data, |
72 int data_length, | 73 int data_length, |
73 int encoded_data_length) OVERRIDE; | 74 int encoded_data_length) OVERRIDE; |
74 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 75 virtual void OnCompletedRequest( |
75 const std::string& security_info, | 76 const net::URLRequestStatus& status, |
76 const base::Time& completion_time) OVERRIDE; | 77 const std::string& security_info, |
| 78 const base::TimeTicks& completion_time) OVERRIDE; |
77 | 79 |
78 protected: | 80 protected: |
79 // Invoked when the entire request has been processed before the data is sent | 81 // Invoked when the entire request has been processed before the data is sent |
80 // to the original peer, giving an opportunity to subclasses to process the | 82 // to the original peer, giving an opportunity to subclasses to process the |
81 // data in data_. If this method returns true, the data is fed to the | 83 // data in data_. If this method returns true, the data is fed to the |
82 // original peer, if it returns false, an error is sent instead. | 84 // original peer, if it returns false, an error is sent instead. |
83 virtual bool DataReady() = 0; | 85 virtual bool DataReady() = 0; |
84 | 86 |
85 webkit_glue::ResourceResponseInfo response_info_; | 87 webkit_glue::ResourceResponseInfo response_info_; |
86 std::string data_; | 88 std::string data_; |
(...skipping 19 matching lines...) Expand all Loading... |
106 const std::string& mime_type, | 108 const std::string& mime_type, |
107 const std::string& data); | 109 const std::string& data); |
108 virtual ~ReplaceContentPeer(); | 110 virtual ~ReplaceContentPeer(); |
109 | 111 |
110 // ResourceLoaderBridge::Peer Implementation. | 112 // ResourceLoaderBridge::Peer Implementation. |
111 virtual void OnReceivedResponse( | 113 virtual void OnReceivedResponse( |
112 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; | 114 const webkit_glue::ResourceResponseInfo& info) OVERRIDE; |
113 virtual void OnReceivedData(const char* data, | 115 virtual void OnReceivedData(const char* data, |
114 int data_length, | 116 int data_length, |
115 int encoded_data_length) OVERRIDE; | 117 int encoded_data_length) OVERRIDE; |
116 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 118 virtual void OnCompletedRequest( |
117 const std::string& security_info, | 119 const net::URLRequestStatus& status, |
118 const base::Time& completion_time) OVERRIDE; | 120 const std::string& security_info, |
| 121 const base::TimeTicks& completion_time) OVERRIDE; |
119 | 122 |
120 private: | 123 private: |
121 webkit_glue::ResourceResponseInfo response_info_; | 124 webkit_glue::ResourceResponseInfo response_info_; |
122 std::string mime_type_; | 125 std::string mime_type_; |
123 std::string data_; | 126 std::string data_; |
124 | 127 |
125 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); | 128 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); |
126 }; | 129 }; |
127 | 130 |
128 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ | 131 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ |
OLD | NEW |