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
|
@ -19,6 +19,7 @@
|
|||
#include "atom/browser/browser.h"
|
||||
#include "atom/browser/login_handler.h"
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/content_converter.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/node_includes.h"
|
||||
#include "atom/common/options_switches.h"
|
||||
|
@ -241,9 +242,9 @@ void App::OnSelectCertificate(
|
|||
}
|
||||
|
||||
void App::OnLogin(LoginHandler* login_handler) {
|
||||
bool prevent_default =
|
||||
Emit("login", base::Bind(&PassLoginInformation,
|
||||
make_scoped_refptr(login_handler)));
|
||||
bool prevent_default = Emit(
|
||||
"login", login_handler->request(), login_handler->auth_info(),
|
||||
base::Bind(&PassLoginInformation, make_scoped_refptr(login_handler)));
|
||||
|
||||
// Default behavior is to alwasy cancel the auth.
|
||||
if (!prevent_default)
|
||||
|
|
|
@ -12,27 +12,12 @@
|
|||
#include "atom/browser/net/url_request_fetch_job.h"
|
||||
#include "atom/browser/net/url_request_string_job.h"
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/content_converter.h"
|
||||
#include "atom/common/node_includes.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
namespace mate {
|
||||
|
||||
template<>
|
||||
struct Converter<const net::URLRequest*> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const net::URLRequest* val) {
|
||||
return mate::ObjectTemplateBuilder(isolate)
|
||||
.SetValue("method", val->method())
|
||||
.SetValue("url", val->url().spec())
|
||||
.SetValue("referrer", val->referrer())
|
||||
.Build()->NewInstance();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mate
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace api {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue