Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Side by Side Diff: ios/clean/chrome/browser/ui/dialogs/http_auth_dialogs/http_auth_dialog_request.h

Issue 2930763003: [iOS Clean] Added HTTP authentication dialog support.
Patch Set: rebase && Mark's comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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.
4
5 #ifndef IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_HTTP_AUTH_DIALOGS_HTTP_AUTH_DIALOG_R EQUEST_H_
6 #define IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_HTTP_AUTH_DIALOGS_HTTP_AUTH_DIALOG_R EQUEST_H_
7
8 #import <Foundation/Foundation.h>
9
10 namespace web {
11 class WebState;
12 }
13
14 // Block type for HTTP authentication callbacks.
15 typedef void (^HTTPAuthDialogCallback)(NSString* username, NSString* password);
16
17 // A container object encapsulating all the state necessary to support an
18 // HTTPAuthDialogCoordiantor. This object also owns the WebKit
19 // completion block that will throw an exception if it is deallocated before
20 // being executed. |-runCallbackWithUserName:password:| must be executed once in
21 // the lifetime of every HTTPAuthDialogRequest.
22 @interface HTTPAuthDialogRequest : NSObject
23
24 // Factory method to create HTTPAuthDialogRequests from the given input. All
25 // arguments to this function are expected to be nonnull.
26 + (instancetype)stateWithWebState:(web::WebState*)webState
27 protectionSpace:(NSURLProtectionSpace*)protectionSpace
28 credential:(NSURLCredential*)credential
29 callback:(HTTPAuthDialogCallback)callback;
30
31 // The WebState displaying this dialog.
32 @property(nonatomic, readonly) web::WebState* webState;
33
34 // The title to use for the dialog.
35 @property(nonatomic, readonly, strong) NSString* title;
36
37 // The authentication message for the dialog's protection space.
38 @property(nonatomic, readonly, strong) NSString* message;
39
40 // The default text to display in the username text field.
41 @property(nonatomic, readonly, strong) NSString* defaultUserNameText;
42
43 // Completes the HTTP authentication flow with the given username and password.
44 // If the user taps the OK button, |username| and |password| are expected to be
45 // non-nil, even if they are empty strings. If the user taps the Cancel button,
46 // arguments should be nil.
47 - (void)completeAuthenticationWithUsername:(NSString*)username
48 password:(NSString*)password;
49
50 @end
51
52 #endif // IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_HTTP_AUTH_DIALOGS_HTTP_AUTH_DIALO G_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698