Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/cpp/iedriver/CookieManager.h
2867 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
17
#ifndef WEBDRIVER_COOKIEMANAGER_H_
18
#define WEBDRIVER_COOKIEMANAGER_H_
19
20
#include <map>
21
#include <string>
22
#include <vector>
23
24
namespace webdriver {
25
26
// Forward declaration of classes.
27
class BrowserCookie;
28
class HookProcessor;
29
30
class CookieManager {
31
public:
32
CookieManager(void);
33
virtual ~CookieManager(void);
34
35
static unsigned int WINAPI ThreadProc(LPVOID lpParameter);
36
37
void Initialize(HWND window_handle);
38
int GetCookies(const std::string& url,
39
std::vector<BrowserCookie>* all_cookies);
40
int SetCookie(const std::string& url, const BrowserCookie& cookie);
41
bool DeleteCookie(const std::string& url, const BrowserCookie& cookie);
42
43
private:
44
std::wstring SendGetCookieMessage(const std::wstring& url,
45
const unsigned int message,
46
HookProcessor* hook);
47
void ParseCookieString(const std::wstring& cookie_string,
48
std::map<std::string, std::string>* cookies);
49
BrowserCookie ParseSingleCookie(const std::string& cookie);
50
void ParseCookieList(const std::string& cookie_file_contents,
51
const bool include_secure_cookies,
52
std::map<std::string, BrowserCookie>* cookies);
53
std::string ReadCookieFile(const std::wstring& file_name);
54
55
bool RecursivelyDeleteCookie(const std::string& url, const BrowserCookie& cookie);
56
bool RecurseCookiePath(const std::string& url, const BrowserCookie& cookie);
57
bool RecurseCookieDomain(const std::string& url, const BrowserCookie& cookie);
58
59
bool IsAdvancedCookiesApi(void);
60
61
HWND window_handle_;
62
};
63
64
} // namespace webdriver
65
66
#endif // WEBDRIVER_IE_BROWSER_H_
67
68