register cookieable schemes with browser context

This commit is contained in:
deepak1556 2016-08-04 12:15:45 +05:30
parent 52431506ba
commit 2aa1c9e556
3 changed files with 24 additions and 3 deletions

View file

@ -17,7 +17,6 @@
#include "atom/common/options_switches.h"
#include "base/command_line.h"
#include "base/strings/string_util.h"
#include "brightray/common/switches.h"
#include "content/public/browser/child_process_security_policy.h"
#include "native_mate/dictionary.h"
#include "url/url_util.h"
@ -30,6 +29,9 @@ namespace api {
namespace {
// List of registered custom standard schemes.
std::vector<std::string> g_standard_schemes;
// Clear protocol handlers in IO thread.
void ClearJobFactoryInIO(
scoped_refptr<brightray::URLRequestContextGetter> request_context_getter) {
@ -43,6 +45,7 @@ void ClearJobFactoryInIO(
Protocol::Protocol(v8::Isolate* isolate, AtomBrowserContext* browser_context)
: request_context_getter_(browser_context->GetRequestContext()),
weak_factory_(this) {
browser_context->SetCookieableSchemes(g_standard_schemes);
Init(isolate);
}
@ -210,8 +213,8 @@ void RegisterStandardSchemes(
auto command_line = base::CommandLine::ForCurrentProcess();
command_line->AppendSwitchASCII(atom::switches::kStandardSchemes,
base::JoinString(schemes, ","));
command_line->AppendSwitchASCII(brightray::switches::kCookieableSchemes,
base::JoinString(schemes, ","));
atom::api::g_standard_schemes = schemes;
}
void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,