From e96b22430765d9fb7fef4d3e2bd8550d269a59cc Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 4 Aug 2016 12:20:19 +0530 Subject: [PATCH] allow delegate to provide cookieable schemes --- brightray/browser/url_request_context_getter.cc | 15 ++------------- brightray/browser/url_request_context_getter.h | 3 +++ brightray/common/switches.cc | 3 --- brightray/common/switches.h | 1 - 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/brightray/browser/url_request_context_getter.cc b/brightray/browser/url_request_context_getter.cc index b07fe88d663..46860d79198 100644 --- a/brightray/browser/url_request_context_getter.cc +++ b/brightray/browser/url_request_context_getter.cc @@ -14,7 +14,6 @@ #include "base/command_line.h" #include "base/memory/ptr_util.h" -#include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/threading/sequenced_worker_pool.h" #include "base/threading/worker_pool.h" @@ -172,26 +171,16 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { storage_.reset(new net::URLRequestContextStorage(url_request_context_.get())); std::unique_ptr cookie_store = nullptr; - std::vector default_cookieable_schemes = {"http", "https", "ws", "wss"}; - auto schemes_string = command_line.GetSwitchValueASCII(switches::kCookieableSchemes); - if (!schemes_string.empty()) { - auto additional_cookieable_schemes = base::SplitString(schemes_string, ",", - base::TRIM_WHITESPACE, - base::SPLIT_WANT_NONEMPTY); - default_cookieable_schemes.insert(default_cookieable_schemes.end(), - additional_cookieable_schemes.begin(), - additional_cookieable_schemes.end()); - } if (in_memory_) { auto cookie_config = content::CookieStoreConfig(); - cookie_config.cookieable_schemes = default_cookieable_schemes; + cookie_config.cookieable_schemes = delegate_->GetCookieableSchemes(); cookie_store = content::CreateCookieStore(cookie_config); } else { auto cookie_config = content::CookieStoreConfig( base_path_.Append(FILE_PATH_LITERAL("Cookies")), content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr, nullptr); - cookie_config.cookieable_schemes = default_cookieable_schemes; + cookie_config.cookieable_schemes = delegate_->GetCookieableSchemes(); cookie_store = content::CreateCookieStore(cookie_config); } storage_->set_cookie_store(std::move(cookie_store)); diff --git a/brightray/browser/url_request_context_getter.h b/brightray/browser/url_request_context_getter.h index aef0e96fe6f..dfe233f2831 100644 --- a/brightray/browser/url_request_context_getter.h +++ b/brightray/browser/url_request_context_getter.h @@ -47,6 +47,9 @@ class URLRequestContextGetter : public net::URLRequestContextGetter { const base::FilePath& base_path); virtual std::unique_ptr CreateCertVerifier(); virtual net::SSLConfigService* CreateSSLConfigService(); + virtual std::vector GetCookieableSchemes() { + return std::vector(); + } }; URLRequestContextGetter( diff --git a/brightray/common/switches.cc b/brightray/common/switches.cc index 3fc6d312591..7ca869ae98f 100644 --- a/brightray/common/switches.cc +++ b/brightray/common/switches.cc @@ -49,9 +49,6 @@ const char kAuthServerWhitelist[] = "auth-server-whitelist"; // Whitelist containing servers for which Kerberos delegation is allowed. const char kAuthNegotiateDelegateWhitelist[] = "auth-negotiate-delegate-whitelist"; -// Comma separated list of schemes that should support cookies. -const char kCookieableSchemes[] = "cookieable-schemes"; - } // namespace switches } // namespace brightray diff --git a/brightray/common/switches.h b/brightray/common/switches.h index 962e4149e33..3af00813830 100644 --- a/brightray/common/switches.h +++ b/brightray/common/switches.h @@ -17,7 +17,6 @@ extern const char kProxyPacUrl[]; extern const char kDisableHttp2[]; extern const char kAuthServerWhitelist[]; extern const char kAuthNegotiateDelegateWhitelist[]; -extern const char kCookieableSchemes[]; } // namespace switches