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

Unified Diff: ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/java_script_dialog_state.h

Issue 2928723002: [iOS Clean] Added JavaScript 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/java_script_dialogs/java_script_dialog_state.h
diff --git a/ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/java_script_dialog_state.h b/ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/java_script_dialog_state.h
new file mode 100644
index 0000000000000000000000000000000000000000..201d8b317a5ab02292bb04437bd335e4568643f5
--- /dev/null
+++ b/ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/java_script_dialog_state.h
@@ -0,0 +1,54 @@
+// 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_JAVA_SCRIPT_JAVA_SCRIPT_DIALOG_STATE_H_
+#define IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_JAVA_SCRIPT_DIALOG_STATE_H_
+
+#import <Foundation/Foundation.h>
+
+#import "ios/web/public/java_script_dialog_callback.h"
+#include "ios/web/public/java_script_dialog_type.h"
+
+class GURL;
+
+namespace web {
+class WebState;
+}
+
+// A container object encapsulating all the state necessary to support a
+// JavaScriptDialogCoordinator. This object also owns the WebKit completion
+// block that will throw an exception if it is deallocated befor being executed.
+// |-runCallbackWithSuccess:userInput:| must be executed once in the lifetime of
+// every JavaScriptDialogState.
+@interface JavaScriptDialogState : NSObject
+
+// Factory method to create JavaScriptDialogStates from the given input.
++ (instancetype)stateWithWebState:(web::WebState*)webState
+ type:(web::JavaScriptDialogType)type
+ originURL:(const GURL&)originURL
+ message:(NSString*)message
+ defaultPromptText:(NSString*)defaultPromptText
+ callback:(const web::DialogClosedCallback&)callback;
+
+// The WebState displaying this dialog.
+@property(nonatomic, readonly) web::WebState* webState;
+
+// The type of dialog to display.
+@property(nonatomic, readonly) web::JavaScriptDialogType type;
+
+// The title to use for the dialog.
+@property(nonatomic, readonly, strong) NSString* title;
+
+// The dialog message supplied by the page.
+@property(nonatomic, readonly, strong) NSString* message;
+
+// The default text to display in the text field for prompt dialogs.
+@property(nonatomic, readonly, strong) NSString* defaultPromptText;
+
+// Calls the callback passed on initialization with the provided parameters.
+- (void)runCallbackWithSuccess:(BOOL)success userInput:(NSString*)userInput;
+
+@end
+
+#endif // IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_JAVA_SCRIPT_DIALOG_STATE_H_

Powered by Google App Engine
This is Rietveld 408576698