2011-02-09 23:04:35 +01:00
|
|
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#ifndef CEF_LIBCEF_HTTP_HEADER_UTILS_H_
|
|
|
|
#define CEF_LIBCEF_HTTP_HEADER_UTILS_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2011-02-09 23:04:35 +01:00
|
|
|
|
2011-12-23 18:36:30 +01:00
|
|
|
#include "include/cef_request.h"
|
2011-12-21 19:35:55 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h"
|
2011-12-16 15:51:10 +01:00
|
|
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
|
2011-02-09 23:04:35 +01:00
|
|
|
|
|
|
|
namespace HttpHeaderUtils {
|
|
|
|
|
|
|
|
typedef CefRequest::HeaderMap HeaderMap;
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
class HeaderVisitor : public WebKit::WebHTTPHeaderVisitor {
|
|
|
|
public:
|
|
|
|
explicit HeaderVisitor(HeaderMap* map) : map_(map) {}
|
2011-02-09 23:04:35 +01:00
|
|
|
|
|
|
|
virtual void visitHeader(const WebKit::WebString& name,
|
2012-01-10 00:46:23 +01:00
|
|
|
const WebKit::WebString& value) {
|
2011-02-09 23:04:35 +01:00
|
|
|
map_->insert(std::make_pair(string16(name), string16(value)));
|
|
|
|
}
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
private:
|
2011-02-09 23:04:35 +01:00
|
|
|
HeaderMap* map_;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::string GenerateHeaders(const HeaderMap& map);
|
|
|
|
void ParseHeaders(const std::string& header_str, HeaderMap& map);
|
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
}; // namespace HttpHeaderUtils
|
2011-02-09 23:04:35 +01:00
|
|
|
|
2012-01-10 00:46:23 +01:00
|
|
|
#endif // CEF_LIBCEF_HTTP_HEADER_UTILS_H_
|