| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_FRAME_PROTOCOL_SINK_WRAP_H_ | 5 #ifndef CHROME_FRAME_PROTOCOL_SINK_WRAP_H_ |
| 6 #define CHROME_FRAME_PROTOCOL_SINK_WRAP_H_ | 6 #define CHROME_FRAME_PROTOCOL_SINK_WRAP_H_ |
| 7 | 7 |
| 8 #include <exdisp.h> | 8 #include <exdisp.h> |
| 9 #include <urlmon.h> | 9 #include <urlmon.h> |
| 10 #include <atlbase.h> | 10 #include <atlbase.h> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 typedef HRESULT (STDMETHODCALLTYPE* InternetProtocol_StartEx_Fn)( | 35 typedef HRESULT (STDMETHODCALLTYPE* InternetProtocol_StartEx_Fn)( |
| 36 IInternetProtocolEx* this_object, IUri* uri, | 36 IInternetProtocolEx* this_object, IUri* uri, |
| 37 IInternetProtocolSink* prot_sink, IInternetBindInfo* bind_info, | 37 IInternetProtocolSink* prot_sink, IInternetBindInfo* bind_info, |
| 38 DWORD flags, HANDLE_PTR reserved); | 38 DWORD flags, HANDLE_PTR reserved); |
| 39 typedef HRESULT (STDMETHODCALLTYPE* InternetProtocol_LockRequest_Fn)( | 39 typedef HRESULT (STDMETHODCALLTYPE* InternetProtocol_LockRequest_Fn)( |
| 40 IInternetProtocol* this_object, DWORD options); | 40 IInternetProtocol* this_object, DWORD options); |
| 41 typedef HRESULT (STDMETHODCALLTYPE* InternetProtocol_UnlockRequest_Fn)( | 41 typedef HRESULT (STDMETHODCALLTYPE* InternetProtocol_UnlockRequest_Fn)( |
| 42 IInternetProtocol* this_object); | 42 IInternetProtocol* this_object); |
| 43 | 43 |
| 44 | 44 |
| 45 enum RendererType { | |
| 46 UNDETERMINED, | |
| 47 CHROME, | |
| 48 OTHER | |
| 49 }; | |
| 50 | |
| 51 class ProtData; | 45 class ProtData; |
| 52 | 46 |
| 53 // A class to wrap protocol sink in IInternetProtocol::Start[Ex] for | 47 // A class to wrap protocol sink in IInternetProtocol::Start[Ex] for |
| 54 // HTTP and HTTPS protocols. | 48 // HTTP and HTTPS protocols. |
| 55 // | 49 // |
| 56 // This is an alternative to a mime filter and we have to do this in order | 50 // This is an alternative to a mime filter and we have to do this in order |
| 57 // to inspect initial portion of HTML for 'chrome' meta tag and report | 51 // to inspect initial portion of HTML for 'chrome' meta tag and report |
| 58 // a different mime type in that case. | 52 // a different mime type in that case. |
| 59 // | 53 // |
| 60 // We implement several documented interfaces | 54 // We implement several documented interfaces |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 131 } |
| 138 | 132 |
| 139 // Removes the mapping between the protocol and the ProtData. | 133 // Removes the mapping between the protocol and the ProtData. |
| 140 void Invalidate(); | 134 void Invalidate(); |
| 141 | 135 |
| 142 private: | 136 private: |
| 143 typedef std::map<IInternetProtocol*, ProtData*> ProtocolDataMap; | 137 typedef std::map<IInternetProtocol*, ProtData*> ProtocolDataMap; |
| 144 static ProtocolDataMap datamap_; | 138 static ProtocolDataMap datamap_; |
| 145 static Lock datamap_lock_; | 139 static Lock datamap_lock_; |
| 146 | 140 |
| 147 // Url we are retrieving. Used for IsOptInUrl() only. | 141 // Url we are retrieving. Used for RendererTypeForUrl() only. |
| 148 std::wstring url_; | 142 std::wstring url_; |
| 149 // HTTP "Referrer" header if we detect are going to switch. | 143 // HTTP "Referrer" header if we detect are going to switch. |
| 150 // We have to save and pass it to Chrome, so scripts can read it via DOM. | 144 // We have to save and pass it to Chrome, so scripts can read it via DOM. |
| 151 std::string referrer_; | 145 std::string referrer_; |
| 152 | 146 |
| 153 // Our gate to IInternetProtocol::Read() | 147 // Our gate to IInternetProtocol::Read() |
| 154 IInternetProtocol* protocol_; | 148 IInternetProtocol* protocol_; |
| 155 InternetProtocol_Read_Fn read_fun_; | 149 InternetProtocol_Read_Fn read_fun_; |
| 156 | 150 |
| 157 // What BINDSTATUS_MIMETYPEAVAILABLE and Co. tells us. | 151 // What BINDSTATUS_MIMETYPEAVAILABLE and Co. tells us. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 180 | 174 |
| 181 struct TransactionHooks { | 175 struct TransactionHooks { |
| 182 void InstallHooks(); | 176 void InstallHooks(); |
| 183 void RevertHooks(); | 177 void RevertHooks(); |
| 184 }; | 178 }; |
| 185 | 179 |
| 186 DECLSPEC_SELECTANY struct TransactionHooks g_trans_hooks; | 180 DECLSPEC_SELECTANY struct TransactionHooks g_trans_hooks; |
| 187 | 181 |
| 188 #endif // CHROME_FRAME_PROTOCOL_SINK_WRAP_H_ | 182 #endif // CHROME_FRAME_PROTOCOL_SINK_WRAP_H_ |
| 189 | 183 |
| OLD | NEW |