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