Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

[REVIEW ONLY] Enable Cookies #464

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions appshell/cefclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app) {
g_command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop);
#endif

settings.persist_session_cookies = true;
CefString(&settings.cache_path) =
g_command_line->GetSwitchValue(cefclient::kCachePath);
CefString(&settings.log_file) =
Expand Down
10 changes: 10 additions & 0 deletions appshell/client_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ ClientHandler::ClientHandler()
callbackId = 0;
CreateProcessMessageDelegates(process_message_delegates_);
CreateRequestDelegates(request_delegates_);

// Default schemes that support cookies.
cookieable_schemes_.push_back("http");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any reason to store this information in a member var? seems like we just need to create the array, add the schemes we want cef to store cookies for and call CefCookieManager::SetSupportedSchemes and we're done. Or does the CefCookieManager not make a copy of the schemes in the array for some reason?

cookieable_schemes_.push_back("https");
cookieable_schemes_.push_back("file");

// Register cookieable schemes with the global cookie manager.
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager();
ASSERT(manager.get());
manager->SetSupportedSchemes(cookieable_schemes_);
}

ClientHandler::~ClientHandler() {
Expand Down
3 changes: 3 additions & 0 deletions appshell/client_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ class ClientHandler : public CefClient,
IMPLEMENT_REFCOUNTING(ClientHandler);
// Include the default locking implementation.
IMPLEMENT_LOCKING(ClientHandler);

// Schemes that will be registered with the global cookie manager.
std::vector<CefString> cookieable_schemes_;
};

#endif // CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_