| OLD | NEW |
| (Empty) |
| 1 // Copyright 2007-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 // | |
| 16 // IBindStatusCallback interface. Support for HTTP POST. | |
| 17 | |
| 18 #ifndef OMAHA_NET_BIND_STATUS_CALLBACK_H__ | |
| 19 #define OMAHA_NET_BIND_STATUS_CALLBACK_H__ | |
| 20 | |
| 21 #include <windows.h> | |
| 22 #include <urlmon.h> | |
| 23 #include <atlbase.h> | |
| 24 #include <atlcom.h> | |
| 25 #include <atlsafe.h> | |
| 26 #include <atlstr.h> | |
| 27 #include "omaha/base/scoped_any.h" | |
| 28 #include "omaha/base/synchronized.h" | |
| 29 | |
| 30 namespace omaha { | |
| 31 | |
| 32 class ATL_NO_VTABLE BindStatusCallback | |
| 33 : public CComObjectRootEx<CComObjectThreadModel>, | |
| 34 public IBindStatusCallback, | |
| 35 public IHttpNegotiate { | |
| 36 public: | |
| 37 HRESULT Send(BSTR url, | |
| 38 BSTR post_data, | |
| 39 BSTR request_headers, | |
| 40 VARIANT response_headers_needed, | |
| 41 VARIANT* response_headers, | |
| 42 DWORD* response_code, | |
| 43 BSTR* cache_filename); | |
| 44 | |
| 45 HRESULT Cancel(); | |
| 46 | |
| 47 // C4505: unreferenced IUnknown local functions have been removed | |
| 48 #pragma warning(disable : 4505) | |
| 49 BEGIN_COM_MAP(BindStatusCallback) | |
| 50 COM_INTERFACE_ENTRY(IBindStatusCallback) | |
| 51 COM_INTERFACE_ENTRY(IHttpNegotiate) | |
| 52 END_COM_MAP() | |
| 53 | |
| 54 // IBindStatusCallback methods. | |
| 55 STDMETHODIMP OnStartBinding(DWORD reserved, IBinding* binding); | |
| 56 STDMETHODIMP GetPriority(LONG* priority); | |
| 57 STDMETHODIMP OnLowResource(DWORD reserved); | |
| 58 STDMETHODIMP OnProgress(ULONG, ULONG, ULONG, LPCWSTR); | |
| 59 STDMETHODIMP OnStopBinding(HRESULT, LPCWSTR); | |
| 60 STDMETHODIMP GetBindInfo(DWORD* bindf_flags, BINDINFO* bind_info); | |
| 61 STDMETHODIMP OnDataAvailable(DWORD, DWORD, FORMATETC*, STGMEDIUM*); | |
| 62 STDMETHODIMP OnObjectAvailable(REFIID, IUnknown*); | |
| 63 | |
| 64 // IHttpNegotiate methods | |
| 65 STDMETHODIMP BeginningTransaction(LPCWSTR url, | |
| 66 LPCWSTR request_headers, | |
| 67 DWORD reserved, | |
| 68 LPWSTR* additional_headers); | |
| 69 STDMETHODIMP OnResponse(DWORD response_code, | |
| 70 LPCWSTR response_headers, | |
| 71 LPCWSTR request_headers, | |
| 72 LPWSTR* additional_request_headers); | |
| 73 | |
| 74 protected: | |
| 75 BindStatusCallback(); | |
| 76 virtual ~BindStatusCallback() {} | |
| 77 | |
| 78 private: | |
| 79 LLock lock_; | |
| 80 BINDVERB http_verb_; | |
| 81 scoped_hglobal post_data_; | |
| 82 DWORD post_data_byte_count_; | |
| 83 CString request_headers_; | |
| 84 CComSafeArray<DWORD> response_headers_needed_; | |
| 85 CComVariant response_headers_; | |
| 86 DWORD response_code_; | |
| 87 CComGITPtr<IBinding> binding_git_; | |
| 88 }; | |
| 89 | |
| 90 } // namespace omaha | |
| 91 | |
| 92 #endif // OMAHA_NET_BIND_STATUS_CALLBACK_H__ | |
| 93 | |
| OLD | NEW |