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

Unified Diff: ios/clean/chrome/browser/ui/dialogs/http_auth_dialogs/http_auth_dialog_state.h

Issue 2930763003: [iOS Clean] Added HTTP authentication dialog support.
Patch Set: rebased, subclassed DialogMediator Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ios/clean/chrome/browser/ui/dialogs/http_auth_dialogs/http_auth_dialog_state.h
diff --git a/ios/clean/chrome/browser/ui/dialogs/http_auth_dialogs/http_auth_dialog_state.h b/ios/clean/chrome/browser/ui/dialogs/http_auth_dialogs/http_auth_dialog_state.h
new file mode 100644
index 0000000000000000000000000000000000000000..e94961cc02967444ed364989bb91d508e59e22f2
--- /dev/null
+++ b/ios/clean/chrome/browser/ui/dialogs/http_auth_dialogs/http_auth_dialog_state.h
@@ -0,0 +1,48 @@
+// Copyright 2017 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 IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_HTTP_AUTH_DIALOGS_HTTP_AUTH_DIALOG_STATE_H_
+#define IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_HTTP_AUTH_DIALOGS_HTTP_AUTH_DIALOG_STATE_H_
+
+#import <Foundation/Foundation.h>
+
+namespace web {
+class WebState;
+}
+
+// Block type for HTTP authentication callbacks.
+typedef void (^HTTPAuthDialogCallback)(NSString* username, NSString* password);
+
+// A container object encapsulating all the state necessary to support an
marq (ping after 24h) 2017/06/14 11:19:15 Name quibbles -- I'm not wild about "State", becau
kkhorimoto 2017/06/23 06:25:41 Done.
+// HTTPAuthDialogCoordiantor. This object also owns the WebKit
+// completion block that will throw an exception if it is deallocated before
+// being executed. |-runCallbackWithUserName:password:| must be executed once in
+// the lifetime of every JavaScriptDialogState.
marq (ping after 24h) 2017/06/14 11:19:16 HTTPAuthDialogState, here an elsewhere. Careful wi
kkhorimoto 2017/06/23 06:25:41 Fixed. I don't think they should share a supercla
+@interface HTTPAuthDialogState : NSObject
+
+// Factory method to create JavaScriptDialogStates from the given input.
++ (instancetype)stateWithWebState:(web::WebState*)webState
+ protectionSpace:(NSURLProtectionSpace*)protectionSpace
+ credential:(NSURLCredential*)credential
+ callback:(HTTPAuthDialogCallback)callback;
+
+// The WebState displaying this dialog.
+@property(nonatomic, readonly) web::WebState* webState;
+
+// The title to use for the dialog.
+@property(nonatomic, readonly) NSString* title;
marq (ping after 24h) 2017/06/14 11:19:15 You're marking other readonly string properties as
kkhorimoto 2017/06/23 06:25:41 Done.
+
+// The authentication message for the dialog's protection space.
+@property(nonatomic, readonly, strong) NSString* message;
+
+// The default text to display in the username text field.
+@property(nonatomic, readonly, strong) NSString* defaultUserNameText;
+
+// Calls the callback passed on initialization with the provided parameters.
marq (ping after 24h) 2017/06/14 11:19:15 I regard the callback as an implementation detail.
kkhorimoto 2017/06/23 06:25:41 Done.
+- (void)runCallbackWithUserName:(NSString*)username
+ password:(NSString*)password;
+
+@end
+
+#endif // IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_HTTP_AUTH_DIALOGS_HTTP_AUTH_DIALOG_STATE_H_

Powered by Google App Engine
This is Rietveld 408576698