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

Side by Side Diff: ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/java_script_dialog_request.h

Issue 2928723002: [iOS Clean] Added JavaScript dialog support.
Patch Set: rebase & Mark's comments 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 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_JAVA_SCRIPT_JAVA_SCRIPT_DIALOG_STATE _H_
6 #define IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_JAVA_SCRIPT_DIALOG_STATE _H_
7
8 #import <Foundation/Foundation.h>
9
10 #import "ios/web/public/java_script_dialog_callback.h"
11 #include "ios/web/public/java_script_dialog_type.h"
12
13 class GURL;
14
15 namespace web {
16 class WebState;
17 }
18
19 // A container object encapsulating all the state necessary to support a
20 // JavaScriptDialogCoordinator. This object also owns the WebKit completion
21 // block that will throw an exception if it is deallocated befor being executed.
22 // |-runCallbackWithSuccess:userInput:| must be executed once in the lifetime of
23 // every JavaScriptDialogRequest.
24 @interface JavaScriptDialogRequest : NSObject
25
26 // Factory method to create JavaScriptDialogRequests from the given input.
27 + (instancetype)stateWithWebState:(web::WebState*)webState
28 type:(web::JavaScriptDialogType)type
29 originURL:(const GURL&)originURL
30 message:(NSString*)message
31 defaultPromptText:(NSString*)defaultPromptText
32 callback:(const web::DialogClosedCallback&)callback;
33
34 // The WebState displaying this dialog.
35 @property(nonatomic, readonly) web::WebState* webState;
36
37 // The type of dialog to display.
38 @property(nonatomic, readonly) web::JavaScriptDialogType type;
39
40 // The title to use for the dialog.
41 @property(nonatomic, readonly, strong) NSString* title;
42
43 // The dialog message supplied by the page.
44 @property(nonatomic, readonly, strong) NSString* message;
45
46 // The default text to display in the text field for prompt dialogs.
47 @property(nonatomic, readonly, strong) NSString* defaultPromptText;
48
49 // Finishes the request with the proved parameters. |success| indicates whether
50 // the user tapped on the OK or Cancel button of the dialog. For prompts,
51 // |userInput| should be the input into the text field. For cancelled prompts
52 // or for alerts/confirmations, |userInput| should be nil.
53 - (void)finishRequestWithSuccess:(BOOL)success userInput:(NSString*)userInput;
54
55 @end
56
57 #endif // IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_JAVA_SCRIPT_DIALOG_ST ATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698