blob: 84b0493819fb3cd2c686581e333d1f1d85ce4715 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_SHELL_BROWSER_SHELL_LOGIN_DIALOG_H_
#define CONTENT_SHELL_BROWSER_SHELL_LOGIN_DIALOG_H_
#include "base/compiler_specific.h"
#include "base/strings/string16.h"
#include "content/public/browser/resource_dispatcher_host_login_delegate.h"
#if defined(OS_MACOSX)
#if __OBJC__
@class ShellLoginDialogHelper;
#else
class ShellLoginDialogHelper;
#endif // __OBJC__
#endif // defined(OS_MACOSX)
namespace net {
class AuthChallengeInfo;
class URLRequest;
}
namespace content {
// This class provides a dialog box to ask the user for credentials. Useful in
// ResourceDispatcherHostDelegate::CreateLoginDelegate.
class ShellLoginDialog : public ResourceDispatcherHostLoginDelegate {
public:
// Threading: IO thread.
ShellLoginDialog(net::AuthChallengeInfo* auth_info, net::URLRequest* request);
// ResourceDispatcherHostLoginDelegate implementation:
// Threading: IO thread.
virtual void OnRequestCancelled() override;
// Called by the platform specific code when the user responds. Public because
// the aforementioned platform specific code may not have access to private
// members. Not to be called from client code.
// Threading: UI thread.
void UserAcceptedAuth(const base::string16& username,
const base::string16& password);
void UserCancelledAuth();
protected:
// Threading: any
virtual ~ShellLoginDialog();
private:
// All the methods that begin with Platform need to be implemented by the
// platform specific LoginDialog implementation.
// Creates the dialog.
// Threading: UI thread.
void PlatformCreateDialog(const base::string16& message);
// Called from the destructor to let each platform do any necessary cleanup.
// Threading: UI thread.
void PlatformCleanUp();
// Called from OnRequestCancelled if the request was cancelled.
// Threading: UI thread.
void PlatformRequestCancelled();
// Sets up dialog creation.
// Threading: UI thread.
void PrepDialog(const base::string16& host, const base::string16& realm);
// Sends the authentication to the requester.
// Threading: IO thread.
void SendAuthToRequester(bool success,
const base::string16& username,
const base::string16& password);
// Who/where/what asked for the authentication.
// Threading: IO thread.
scoped_refptr<net::AuthChallengeInfo> auth_info_;
// The request that wants login data.
// Threading: IO thread.
net::URLRequest* request_;
#if defined(OS_MACOSX)
// Threading: UI thread.
ShellLoginDialogHelper* helper_; // owned
#endif
};
} // namespace content
#endif // CONTENT_SHELL_BROWSER_SHELL_LOGIN_DIALOG_H_
|