diff options
author | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-17 04:02:58 +0000 |
---|---|---|
committer | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-17 04:02:58 +0000 |
commit | aaf124502e4c86acf98b88998fca3afcdb88a234 (patch) | |
tree | 3e163bb2cef2512464d8a3f54f2d2f42918a8f48 /chrome_frame/http_negotiate.h | |
parent | 962b98214d0ca8e8db14ae83ccb79667ec440eac (diff) | |
download | chromium_src-aaf124502e4c86acf98b88998fca3afcdb88a234.zip chromium_src-aaf124502e4c86acf98b88998fca3afcdb88a234.tar.gz chromium_src-aaf124502e4c86acf98b88998fca3afcdb88a234.tar.bz2 |
BUG=47879
Review URL: http://codereview.chromium.org/2824057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52806 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/http_negotiate.h')
-rw-r--r-- | chrome_frame/http_negotiate.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/chrome_frame/http_negotiate.h b/chrome_frame/http_negotiate.h index 43ac405..dd4748a 100644 --- a/chrome_frame/http_negotiate.h +++ b/chrome_frame/http_negotiate.h @@ -6,9 +6,11 @@ #define CHROME_FRAME_HTTP_NEGOTIATE_H_ #include <shdeprecated.h> +#include <string> #include <urlmon.h> #include "base/basictypes.h" +#include "base/scoped_comptr_win.h" // Typedefs for IHttpNegotiate methods. typedef HRESULT (STDMETHODCALLTYPE* IHttpNegotiate_BeginningTransaction_Fn)( @@ -76,4 +78,38 @@ HRESULT GetBrowserServiceFromProtocolSink(IInternetProtocolSink* sink, // TODO(robertshield): Remove this once we update our SDK version. extern const int LOCAL_BINDSTATUS_SERVER_MIMETYPEAVAILABLE; +// Scans |additional_headers| and |headers| for User-Agent header or grabs +// the default User-Agent if none is found. Append "chromeframe" at the end +// of the string. Returns the original content of |additional_headers| but +// with the new User-Agent header. Somewhat unusual interface is dictated +// because we use it in IHttpNegotiate::BeginningTransaction. +// The function is a public since we want to use it from +// UrlmonUrlRequest::BeginningTransaction for the unusual but yet possible case +// when |headers| contains an User-Agent string. +// TODO(stoyan): Add unit test. +std::string AppendCFUserAgentString(LPCWSTR headers, + LPCWSTR additional_headers); +// Simple class that wraps IHttpNegotiate interface and adds "chromeframe" +// to User-agent Http header. +class UserAgentAddOn : public IHttpNegotiate { + public: + UserAgentAddOn() {} + ~UserAgentAddOn() {} + void set_delegate(IHttpNegotiate* delegate) { + delegate_ = delegate; + } + + bool has_delegate() const { + return delegate_ != NULL; + } + + protected: + // IHttpNegotiate + STDMETHOD(BeginningTransaction)(LPCWSTR url, LPCWSTR headers, DWORD reserved, + LPWSTR* additional_headers); + STDMETHOD(OnResponse)(DWORD response_code, LPCWSTR response_headers, + LPCWSTR request_headers, LPWSTR* additional_headers); + ScopedComPtr<IHttpNegotiate> delegate_; +}; + #endif // CHROME_FRAME_HTTP_NEGOTIATE_H_ |