Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4424)

Unified Diff: chrome_frame/http_negotiate.h

Issue 2824057: Chromeframe user-agent without need of HttpNegotiate patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/chrome_active_document.cc ('k') | chrome_frame/http_negotiate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/http_negotiate.h
===================================================================
--- chrome_frame/http_negotiate.h (revision 52198)
+++ chrome_frame/http_negotiate.h (working copy)
@@ -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 @@
// 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_
« no previous file with comments | « chrome_frame/chrome_active_document.cc ('k') | chrome_frame/http_negotiate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698