| 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_COMMON_SECURITY_FILTER_PEER_H_ | 5 #ifndef CHROME_COMMON_SECURITY_FILTER_PEER_H_ |
| 6 #define CHROME_COMMON_SECURITY_FILTER_PEER_H_ | 6 #define CHROME_COMMON_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 18 matching lines...) Expand all Loading... |
| 29 int os_error); | 29 int os_error); |
| 30 | 30 |
| 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 bool content_filtered); | |
| 41 virtual void OnDownloadedData(int len) {} | 40 virtual void OnDownloadedData(int len) {} |
| 42 virtual void OnReceivedData(const char* data, int len); | 41 virtual void OnReceivedData(const char* data, int len); |
| 43 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 42 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| 44 const std::string& security_info, | 43 const std::string& security_info, |
| 45 const base::Time& completion_time); | 44 const base::Time& completion_time); |
| 46 | 45 |
| 47 protected: | 46 protected: |
| 48 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, | 47 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, |
| 49 webkit_glue::ResourceLoaderBridge::Peer* peer); | 48 webkit_glue::ResourceLoaderBridge::Peer* peer); |
| 50 | 49 |
| 51 webkit_glue::ResourceLoaderBridge::Peer* original_peer_; | 50 webkit_glue::ResourceLoaderBridge::Peer* original_peer_; |
| 52 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_; | 51 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_; |
| 53 | 52 |
| 54 private: | 53 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); | 54 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); |
| 56 }; | 55 }; |
| 57 | 56 |
| 58 // The BufferedPeer reads all the data of the request into an internal buffer. | 57 // The BufferedPeer reads all the data of the request into an internal buffer. |
| 59 // Subclasses should implement DataReady() to process the data as necessary. | 58 // Subclasses should implement DataReady() to process the data as necessary. |
| 60 class BufferedPeer : public SecurityFilterPeer { | 59 class BufferedPeer : public SecurityFilterPeer { |
| 61 public: | 60 public: |
| 62 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, | 61 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, |
| 63 webkit_glue::ResourceLoaderBridge::Peer* peer, | 62 webkit_glue::ResourceLoaderBridge::Peer* peer, |
| 64 const std::string& mime_type); | 63 const std::string& mime_type); |
| 65 virtual ~BufferedPeer(); | 64 virtual ~BufferedPeer(); |
| 66 | 65 |
| 67 // ResourceLoaderBridge::Peer Implementation. | 66 // ResourceLoaderBridge::Peer Implementation. |
| 68 virtual void OnReceivedResponse( | 67 virtual void OnReceivedResponse( |
| 69 const webkit_glue::ResourceResponseInfo& info, | 68 const webkit_glue::ResourceResponseInfo& info); |
| 70 bool content_filtered); | |
| 71 virtual void OnReceivedData(const char* data, int len); | 69 virtual void OnReceivedData(const char* data, int len); |
| 72 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 70 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| 73 const std::string& security_info, | 71 const std::string& security_info, |
| 74 const base::Time& completion_time); | 72 const base::Time& completion_time); |
| 75 | 73 |
| 76 protected: | 74 protected: |
| 77 // Invoked when the entire request has been processed before the data is sent | 75 // 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 | 76 // to the original peer, giving an opportunity to subclasses to process the |
| 79 // data in data_. If this method returns true, the data is fed to the | 77 // data in data_. If this method returns true, the data is fed to the |
| 80 // original peer, if it returns false, an error is sent instead. | 78 // original peer, if it returns false, an error is sent instead. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 100 class ReplaceContentPeer : public SecurityFilterPeer { | 98 class ReplaceContentPeer : public SecurityFilterPeer { |
| 101 public: | 99 public: |
| 102 ReplaceContentPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, | 100 ReplaceContentPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, |
| 103 webkit_glue::ResourceLoaderBridge::Peer* peer, | 101 webkit_glue::ResourceLoaderBridge::Peer* peer, |
| 104 const std::string& mime_type, | 102 const std::string& mime_type, |
| 105 const std::string& data); | 103 const std::string& data); |
| 106 virtual ~ReplaceContentPeer(); | 104 virtual ~ReplaceContentPeer(); |
| 107 | 105 |
| 108 // ResourceLoaderBridge::Peer Implementation. | 106 // ResourceLoaderBridge::Peer Implementation. |
| 109 virtual void OnReceivedResponse( | 107 virtual void OnReceivedResponse( |
| 110 const webkit_glue::ResourceResponseInfo& info, | 108 const webkit_glue::ResourceResponseInfo& info); |
| 111 bool content_filtered); | |
| 112 virtual void OnReceivedData(const char* data, int len); | 109 virtual void OnReceivedData(const char* data, int len); |
| 113 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 110 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| 114 const std::string& security_info, | 111 const std::string& security_info, |
| 115 const base::Time& completion_time); | 112 const base::Time& completion_time); |
| 116 | 113 |
| 117 private: | 114 private: |
| 118 webkit_glue::ResourceResponseInfo response_info_; | 115 webkit_glue::ResourceResponseInfo response_info_; |
| 119 std::string mime_type_; | 116 std::string mime_type_; |
| 120 std::string data_; | 117 std::string data_; |
| 121 | 118 |
| 122 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); | 119 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); |
| 123 }; | 120 }; |
| 124 | 121 |
| 125 #endif // CHROME_COMMON_SECURITY_FILTER_PEER_H_ | 122 #endif // CHROME_COMMON_SECURITY_FILTER_PEER_H_ |
| OLD | NEW |