session.cpp
1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "stdafx.h"
#include "etradeclient/utility/session.h"
#include "include/wrapper/cef_helpers.h"
Session::Session() : m_expried(true) /*The initial state should be 'expired'.*/
{}
Session& Session::Instance()
{
static Session session_manager;
#if 0
session_manager.m_user_name = L"relogin_dlg_test";
#endif
return session_manager;
}
void Session::OnExpired()
{
std::lock_guard<std::mutex> lg(m_mtx);
//CEF_REQUIRE_IO_THREAD();
m_cookies.clear();
m_expried = true;
}
void Session::OnValid()
{
std::lock_guard<std::mutex> lg(m_mtx);
m_expried = false;
}
bool Session::IsExpired()
{
std::lock_guard<std::mutex> lg(m_mtx);
return m_expried;
}
void Session::SetCookies(const CookiesT& cookies)
{
m_cookies = cookies;
}
const Session::CookiesT& Session::Cookies() const
{
return m_cookies;
}
void Session::SetUserName(const std::wstring& user_name)
{
m_user_name = user_name;
}
const std::wstring& Session::UserName() const
{
return m_user_name;
}
void Session::SetMerName(const std::wstring& sMerName)
{
m_mer_name = sMerName;
}
const std::wstring& Session::GetMerName() const
{
return m_mer_name;
}