#include"stdafx.h"#include"etradeclient/browser/session.h"#include"include/wrapper/cef_helpers.h"Session::Session():m_expried(true)/*The initial state should be 'expired'.*/{}Session&Session::Instance(){staticSessionsession_manager;returnsession_manager;}voidSession::OnExpired(){std::lock_guard<std::mutex>lg(m_mtx);CEF_REQUIRE_IO_THREAD();m_cookies.clear();m_expried=true;}voidSession::OnValid(){std::lock_guard<std::mutex>lg(m_mtx);m_expried=false;}boolSession::IsExpired(){std::lock_guard<std::mutex>lg(m_mtx);returnm_expried;}voidSession::SetCookies(constCookiesT&cookies){m_cookies=cookies;}constSession::CookiesT&Session::Cookies()const{returnm_cookies;}voidSession::SetUserName(conststd::wstring&user_name){m_user_name=user_name;}conststd::wstring&Session::UserName()const{returnm_user_name;}