Chromium Code Reviews| Index: ios/web/public/dialog_presenter.h |
| diff --git a/ios/web/public/dialog_presenter.h b/ios/web/public/dialog_presenter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a4b67ce89d7b7b656c4cd67660f3bd3062faea9a |
| --- /dev/null |
| +++ b/ios/web/public/dialog_presenter.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2016 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_WEB_PUBLIC_DIALOG_PRESENTER_H_ |
| +#define IOS_WEB_PUBLIC_DIALOG_PRESENTER_H_ |
| + |
| +#include "base/callback.h" |
| +#include "ios/web/public/javascript_message_type.h" |
| +#include "net/base/auth.h" |
| +#include "url/gurl.h" |
| + |
| +@class NSString; |
| +@class NSURLCredential; |
| +@class NSURLProtectionSpace; |
| + |
| +namespace web { |
| + |
| +class WebState; |
| + |
| +class DialogPresenter { |
| + public: |
| + // Callback for |RunJavaScriptDialog|. The |success| value is true if the user |
| + // 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".
|
| + // value will exist for prompt alerts only. |
| + typedef base::Callback<void(bool success, NSString* user_input)> |
| + DialogClosedCallback; |
| + // 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
|
| + // new dialog will be queued and shown after the visible dialog is dismissed. |
| + virtual void RunJavaScriptDialog( |
| + WebState* web_state, |
| + 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.
|
| + JavaScriptMessageType javascript_message_type, |
| + NSString* message_text, |
| + NSString* default_prompt_text, |
| + const DialogClosedCallback& callback) = 0; |
| + // Callback for |RunAuthDialog|. If empty values are provided, the login will |
| + // be rejected. |
| + typedef base::Callback<void(const net::AuthCredentials& credentials)> |
| + AuthDialogCallback; |
| + // 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.
|
| + // already being presented, the new dialog will be queued and shown after the |
| + // visible dialog is dismissed. |
| + virtual void RunAuthDialog(WebState* web_state, |
| + NSURLProtectionSpace* protectionSpace, |
| + NSURLCredential* credential, |
| + const AuthDialogCallback& callback) = 0; |
| + // Cancels the display of any currently displayed dialog and any queued |
| + // dialogs associated with |web_state|. |
| + virtual void CancelActiveAndPendingDialogs(WebState* web_state) = 0; |
| +}; |
| + |
| +} // namespace web |
| + |
| +#endif // IOS_WEB_PUBLIC_DIALOG_PRESENTER_H_ |