Add dummy LoginHandler

This commit is contained in:
Cheng Zhao 2015-10-28 15:34:41 +08:00
parent b86267aa3b
commit 9df89cf79b
5 changed files with 78 additions and 0 deletions

View file

@ -4,6 +4,7 @@
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
#include "atom/browser/login_handler.h"
#include "atom/common/platform_util.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/escape.h"
@ -29,4 +30,11 @@ bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol(
return true;
}
content::ResourceDispatcherHostLoginDelegate*
AtomResourceDispatcherHostDelegate::CreateLoginDelegate(
net::AuthChallengeInfo* auth_info,
net::URLRequest* request) {
return new LoginHandler(auth_info, request);
}
} // namespace atom

View file

@ -21,6 +21,9 @@ class AtomResourceDispatcherHostDelegate
bool is_main_frame,
ui::PageTransition transition,
bool has_user_gesture) override;
content::ResourceDispatcherHostLoginDelegate* CreateLoginDelegate(
net::AuthChallengeInfo* auth_info,
net::URLRequest* request) override;
};
} // namespace atom

View file

@ -0,0 +1,22 @@
// 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/browser/login_handler.h"
#include "net/base/auth.h"
namespace atom {
LoginHandler::LoginHandler(net::AuthChallengeInfo* auth_info,
net::URLRequest* request)
: auth_info_(auth_info), request_(request), weak_factory_(this) {
}
LoginHandler::~LoginHandler() {
}
void LoginHandler::OnRequestCancelled() {
}
} // namespace atom

View file

@ -0,0 +1,43 @@
// 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_BROWSER_LOGIN_HANDLER_H_
#define ATOM_BROWSER_LOGIN_HANDLER_H_
#include "base/memory/weak_ptr.h"
#include "content/public/browser/resource_dispatcher_host_login_delegate.h"
namespace net {
class AuthChallengeInfo;
class URLRequest;
}
namespace atom {
class LoginHandler : public content::ResourceDispatcherHostLoginDelegate {
public:
LoginHandler(net::AuthChallengeInfo* auth_info, net::URLRequest* request);
protected:
~LoginHandler() override;
// content::ResourceDispatcherHostLoginDelegate:
void OnRequestCancelled() override;
private:
// Who/where/what asked for the authentication.
scoped_refptr<net::AuthChallengeInfo> auth_info_;
// The request that wants login data.
// This should only be accessed on the IO loop.
net::URLRequest* request_;
base::WeakPtrFactory<LoginHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(LoginHandler);
};
} // namespace atom
#endif // ATOM_BROWSER_LOGIN_HANDLER_H_

View file

@ -150,6 +150,8 @@
'atom/browser/common_web_contents_delegate.h',
'atom/browser/javascript_environment.cc',
'atom/browser/javascript_environment.h',
'atom/browser/login_handler.cc',
'atom/browser/login_handler.h',
'atom/browser/mac/atom_application.h',
'atom/browser/mac/atom_application.mm',
'atom/browser/mac/atom_application_delegate.h',