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

Side by Side Diff: ios/web/public/dialog_presenter.h

Issue 2074733002: Add public API for handling Javascript alerts and prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 4 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 2016 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_WEB_PUBLIC_DIALOG_PRESENTER_H_
6 #define IOS_WEB_PUBLIC_DIALOG_PRESENTER_H_
7
8 #include "base/callback.h"
9 #include "ios/web/public/javascript_message_type.h"
10 #include "net/base/auth.h"
11 #include "url/gurl.h"
12
13 @class NSString;
14 @class NSURLCredential;
15 @class NSURLProtectionSpace;
16
17 namespace web {
18
19 class WebState;
20
21 class DialogPresenter {
22 public:
23 // Callback for |RunJavaScriptDialog|. The |success| value is true if the user
24 // responded with OK, |false| if the prompt was cancelled. The |user_input|
Eugene But (OOO till 7-30) 2016/06/24 17:04:52 s/prompt/prompt or confirm ?
michaeldo 2016/06/27 20:30:10 Replaced with "dialog".
25 // value will exist for prompt alerts only.
26 typedef base::Callback<void(bool success, NSString* user_input)>
27 DialogClosedCallback;
28 // Displays a Javascript dialog. If a dialog is already being presented, the
Eugene But (OOO till 7-30) 2016/06/24 17:04:52 Please do no assume here how presentation is imple
michaeldo 2016/06/27 20:30:10 yes, this is much better since this is just the pu
29 // new dialog will be queued and shown after the visible dialog is dismissed.
30 virtual void RunJavaScriptDialog(
31 WebState* web_state,
32 const GURL& origin_url,
Eugene But (OOO till 7-30) 2016/06/24 17:04:52 Should this be just origin? There is no actual way
michaeldo 2016/06/27 20:30:09 Done.
Eugene But (OOO till 7-30) 2016/06/27 21:09:37 Sorry for misleading you. You are actually passing
Eugene But (OOO till 7-30) 2016/06/27 22:33:56 I guess you missed this comment.
michaeldo 2016/06/28 17:44:47 Sorry, yes I believe I missed it, fixed now.
33 JavaScriptMessageType javascript_message_type,
34 NSString* message_text,
35 NSString* default_prompt_text,
36 const DialogClosedCallback& callback) = 0;
37 // Callback for |RunAuthDialog|. If empty values are provided, the login will
38 // be rejected.
39 typedef base::Callback<void(const net::AuthCredentials& credentials)>
40 AuthDialogCallback;
41 // Displays a dialog prompting for a username and password. If a dialog is
Eugene But (OOO till 7-30) 2016/06/24 17:04:52 Sorry, I just realized that DialogPresenter should
michaeldo 2016/06/27 20:30:09 Done.
42 // already being presented, the new dialog will be queued and shown after the
43 // visible dialog is dismissed.
44 virtual void RunAuthDialog(WebState* web_state,
45 NSURLProtectionSpace* protectionSpace,
46 NSURLCredential* credential,
47 const AuthDialogCallback& callback) = 0;
48 // Cancels the display of any currently displayed dialog and any queued
49 // dialogs associated with |web_state|.
50 virtual void CancelActiveAndPendingDialogs(WebState* web_state) = 0;
51 };
52
53 } // namespace web
54
55 #endif // IOS_WEB_PUBLIC_DIALOG_PRESENTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698