electron/shell/browser/login_handler.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

57 lines
1.7 KiB
C
Raw Normal View History

2015-10-28 15:34:41 +08:00
// 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 ELECTRON_SHELL_BROWSER_LOGIN_HANDLER_H_
#define ELECTRON_SHELL_BROWSER_LOGIN_HANDLER_H_
2015-10-28 15:34:41 +08:00
#include "base/process/process_handle.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/login_delegate.h"
2015-10-28 15:34:41 +08:00
namespace content {
class WebContents;
}
namespace gin {
class Arguments;
}
2015-10-28 15:34:41 +08:00
namespace electron {
// Handles HTTP basic auth.
class LoginHandler : public content::LoginDelegate {
2015-10-28 15:34:41 +08:00
public:
LoginHandler(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
bool is_main_frame,
base::ProcessId process_id,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
LoginAuthRequiredCallback auth_required_callback);
~LoginHandler() override;
2015-10-28 15:34:41 +08:00
// disable copy
LoginHandler(const LoginHandler&) = delete;
LoginHandler& operator=(const LoginHandler&) = delete;
2015-10-28 15:34:41 +08:00
private:
void EmitEvent(net::AuthChallengeInfo auth_info,
content::WebContents* web_contents,
bool is_main_frame,
base::ProcessId process_id,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt);
void CallbackFromJS(gin::Arguments* args);
2015-10-28 15:34:41 +08:00
LoginAuthRequiredCallback auth_required_callback_;
base::WeakPtrFactory<LoginHandler> weak_factory_{this};
2015-10-28 15:34:41 +08:00
};
} // namespace electron
#endif // ELECTRON_SHELL_BROWSER_LOGIN_HANDLER_H_