Pass auth_info and request in "login" event
This commit is contained in:
parent
d05255179a
commit
131531219e
6 changed files with 75 additions and 19 deletions
34
atom/common/native_mate_converters/content_converter.cc
Normal file
34
atom/common/native_mate_converters/content_converter.cc
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/common/native_mate_converters/content_converter.h"
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
|
||||
namespace mate {
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> Converter<const net::URLRequest*>::ToV8(
|
||||
v8::Isolate* isolate, const net::URLRequest* val) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
dict.Set("method", val->method());
|
||||
dict.Set("url", val->url().spec());
|
||||
dict.Set("referrer", val->referrer());
|
||||
return mate::ConvertToV8(isolate, dict);
|
||||
};
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> Converter<const net::AuthChallengeInfo*>::ToV8(
|
||||
v8::Isolate* isolate, const net::AuthChallengeInfo* val) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
dict.Set("isProxy", val->is_proxy);
|
||||
dict.Set("scheme", val->scheme);
|
||||
dict.Set("host", val->challenger.host());
|
||||
dict.Set("port", static_cast<uint32_t>(val->challenger.port()));
|
||||
dict.Set("realm", val->realm);
|
||||
return mate::ConvertToV8(isolate, dict);
|
||||
};
|
||||
|
||||
} // namespace mate
|
31
atom/common/native_mate_converters/content_converter.h
Normal file
31
atom/common/native_mate_converters/content_converter.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_COMMON_NATIVE_MATE_CONVERTERS_CONTENT_CONVERTER_H_
|
||||
#define ATOM_COMMON_NATIVE_MATE_CONVERTERS_CONTENT_CONVERTER_H_
|
||||
|
||||
#include "native_mate/converter.h"
|
||||
|
||||
namespace net {
|
||||
class AuthChallengeInfo;
|
||||
class URLRequest;
|
||||
}
|
||||
|
||||
namespace mate {
|
||||
|
||||
template<>
|
||||
struct Converter<const net::URLRequest*> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const net::URLRequest* val);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Converter<const net::AuthChallengeInfo*> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const net::AuthChallengeInfo* val);
|
||||
};
|
||||
|
||||
} // namespace mate
|
||||
|
||||
#endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_CONTENT_CONVERTER_H_
|
Loading…
Add table
Add a link
Reference in a new issue