UrlContext.h revision 895fa41e
1/*
2 * Copyright 2010-2014 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _B_URL_CONTEXT_H_
6#define _B_URL_CONTEXT_H_
7
8
9#include <HttpAuthentication.h>
10#include <NetworkCookieJar.h>
11#include <Referenceable.h>
12
13
14namespace BPrivate {
15	template <class key, class value> class SynchronizedHashMap;
16	class HashString;
17}
18
19
20class BUrlContext: public BReferenceable {
21public:
22								BUrlContext();
23								~BUrlContext();
24
25	// Context modifiers
26			void				SetCookieJar(
27									const BNetworkCookieJar& cookieJar);
28			void				AddAuthentication(const BUrl& url,
29									const BHttpAuthentication& authentication);
30
31	// Context accessors
32			BNetworkCookieJar&	GetCookieJar();
33			BHttpAuthentication& GetAuthentication(const BUrl& url);
34
35private:
36			BNetworkCookieJar	fCookieJar;
37			typedef BPrivate::SynchronizedHashMap<BPrivate::HashString,
38				BHttpAuthentication*> BHttpAuthenticationMap;
39			BHttpAuthenticationMap* fAuthenticationMap;
40};
41
42#endif // _B_URL_CONTEXT_H_
43