Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 static SecurityFilterPeer* CreateSecurityFilterPeerForFrame( | 27 static SecurityFilterPeer* CreateSecurityFilterPeerForFrame( |
| 28 webkit_glue::ResourceLoaderBridge::Peer* peer, | 28 webkit_glue::ResourceLoaderBridge::Peer* peer, |
| 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 const base::TimeTicks& start_time, | |
| 37 const base::TimeTicks& end_time, | |
| 36 bool* has_new_first_party_for_cookies, | 38 bool* has_new_first_party_for_cookies, |
| 37 GURL* new_first_party_for_cookies); | 39 GURL* new_first_party_for_cookies); |
| 38 virtual void OnReceivedResponse( | 40 virtual void OnReceivedResponse( |
| 39 const webkit_glue::ResourceResponseInfo& info); | 41 const webkit_glue::ResourceResponseInfo& info, |
| 42 const base::TimeTicks& start_time, | |
| 43 const base::TimeTicks& end_time); | |
| 40 virtual void OnDownloadedData(int len) {} | 44 virtual void OnDownloadedData(int len) {} |
| 41 virtual void OnReceivedData(const char* data, | 45 virtual void OnReceivedData(const char* data, |
| 42 int data_length, | 46 int data_length, |
| 43 int encoded_data_length); | 47 int encoded_data_length); |
| 44 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 48 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| 45 const std::string& security_info, | 49 const std::string& security_info, |
| 46 const base::Time& completion_time); | 50 const base::TimeTicks& completion_time); |
|
jar (doing other things)
2011/11/19 03:42:32
This might be a good place to try out that OVERRID
| |
| 47 | 51 |
| 48 protected: | 52 protected: |
| 49 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, | 53 SecurityFilterPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, |
| 50 webkit_glue::ResourceLoaderBridge::Peer* peer); | 54 webkit_glue::ResourceLoaderBridge::Peer* peer); |
| 51 | 55 |
| 52 webkit_glue::ResourceLoaderBridge::Peer* original_peer_; | 56 webkit_glue::ResourceLoaderBridge::Peer* original_peer_; |
| 53 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_; | 57 webkit_glue::ResourceLoaderBridge* resource_loader_bridge_; |
| 54 | 58 |
| 59 base::TimeTicks start_time_; | |
| 60 base::TimeTicks end_time_; | |
| 61 | |
| 55 private: | 62 private: |
| 56 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); | 63 DISALLOW_COPY_AND_ASSIGN(SecurityFilterPeer); |
| 57 }; | 64 }; |
| 58 | 65 |
| 59 // The BufferedPeer reads all the data of the request into an internal buffer. | 66 // The BufferedPeer reads all the data of the request into an internal buffer. |
| 60 // Subclasses should implement DataReady() to process the data as necessary. | 67 // Subclasses should implement DataReady() to process the data as necessary. |
| 61 class BufferedPeer : public SecurityFilterPeer { | 68 class BufferedPeer : public SecurityFilterPeer { |
| 62 public: | 69 public: |
| 63 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, | 70 BufferedPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, |
| 64 webkit_glue::ResourceLoaderBridge::Peer* peer, | 71 webkit_glue::ResourceLoaderBridge::Peer* peer, |
| 65 const std::string& mime_type); | 72 const std::string& mime_type); |
| 66 virtual ~BufferedPeer(); | 73 virtual ~BufferedPeer(); |
| 67 | 74 |
| 68 // ResourceLoaderBridge::Peer Implementation. | 75 // ResourceLoaderBridge::Peer Implementation. |
| 69 virtual void OnReceivedResponse( | 76 virtual void OnReceivedResponse( |
| 70 const webkit_glue::ResourceResponseInfo& info); | 77 const webkit_glue::ResourceResponseInfo& info, |
| 78 const base::TimeTicks& start_time, | |
| 79 const base::TimeTicks& end_time); | |
| 71 virtual void OnReceivedData(const char* data, | 80 virtual void OnReceivedData(const char* data, |
| 72 int data_length, | 81 int data_length, |
| 73 int encoded_data_length); | 82 int encoded_data_length); |
| 74 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 83 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| 75 const std::string& security_info, | 84 const std::string& security_info, |
| 76 const base::Time& completion_time); | 85 const base::TimeTicks& completion_time); |
| 77 | 86 |
| 78 protected: | 87 protected: |
| 79 // Invoked when the entire request has been processed before the data is sent | 88 // 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 | 89 // 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 | 90 // 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. | 91 // original peer, if it returns false, an error is sent instead. |
| 83 virtual bool DataReady() = 0; | 92 virtual bool DataReady() = 0; |
| 84 | 93 |
| 85 webkit_glue::ResourceResponseInfo response_info_; | 94 webkit_glue::ResourceResponseInfo response_info_; |
| 86 std::string data_; | 95 std::string data_; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 102 class ReplaceContentPeer : public SecurityFilterPeer { | 111 class ReplaceContentPeer : public SecurityFilterPeer { |
| 103 public: | 112 public: |
| 104 ReplaceContentPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, | 113 ReplaceContentPeer(webkit_glue::ResourceLoaderBridge* resource_loader_bridge, |
| 105 webkit_glue::ResourceLoaderBridge::Peer* peer, | 114 webkit_glue::ResourceLoaderBridge::Peer* peer, |
| 106 const std::string& mime_type, | 115 const std::string& mime_type, |
| 107 const std::string& data); | 116 const std::string& data); |
| 108 virtual ~ReplaceContentPeer(); | 117 virtual ~ReplaceContentPeer(); |
| 109 | 118 |
| 110 // ResourceLoaderBridge::Peer Implementation. | 119 // ResourceLoaderBridge::Peer Implementation. |
| 111 virtual void OnReceivedResponse( | 120 virtual void OnReceivedResponse( |
| 112 const webkit_glue::ResourceResponseInfo& info); | 121 const webkit_glue::ResourceResponseInfo& info, |
| 122 const base::TimeTicks& start_time, | |
| 123 const base::TimeTicks& end_time); | |
| 113 virtual void OnReceivedData(const char* data, | 124 virtual void OnReceivedData(const char* data, |
| 114 int data_length, | 125 int data_length, |
| 115 int encoded_data_length); | 126 int encoded_data_length); |
| 116 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 127 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
| 117 const std::string& security_info, | 128 const std::string& security_info, |
| 118 const base::Time& completion_time); | 129 const base::TimeTicks& completion_time); |
| 119 | 130 |
| 120 private: | 131 private: |
| 121 webkit_glue::ResourceResponseInfo response_info_; | 132 webkit_glue::ResourceResponseInfo response_info_; |
| 122 std::string mime_type_; | 133 std::string mime_type_; |
| 123 std::string data_; | 134 std::string data_; |
| 124 | 135 |
| 125 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); | 136 DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer); |
| 126 }; | 137 }; |
| 127 | 138 |
| 128 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ | 139 #endif // CHROME_RENDERER_SECURITY_FILTER_PEER_H_ |
| OLD | NEW |