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

Unified Diff: ios/web/web_state/web_state_impl.mm

Issue 2074733002: Add public API for handling Javascript alerts and prompt. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace BOOL with bool in unittest. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/web_state/web_state_impl.h ('k') | ios/web/web_state/web_state_impl_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/web_state_impl.mm
diff --git a/ios/web/web_state/web_state_impl.mm b/ios/web/web_state/web_state_impl.mm
index 1a56c66c858983a73fcbbd03ba6dfa40b3949501..2fb5e1e8f0897830986826b0915a98b3d96824ed 100644
--- a/ios/web/web_state/web_state_impl.mm
+++ b/ios/web/web_state/web_state_impl.mm
@@ -14,6 +14,7 @@
#include "ios/web/navigation/navigation_item_impl.h"
#include "ios/web/net/request_group_util.h"
#include "ios/web/public/browser_state.h"
+#import "ios/web/public/java_script_dialog_presenter.h"
#include "ios/web/public/navigation_item.h"
#include "ios/web/public/url_util.h"
#include "ios/web/public/web_client.h"
@@ -429,6 +430,32 @@ bool WebStateImpl::HandleContextMenu(const web::ContextMenuParams& params) {
return false;
}
+void WebStateImpl::RunJavaScriptDialog(
+ const GURL& origin_url,
+ JavaScriptDialogType javascript_dialog_type,
+ NSString* message_text,
+ NSString* default_prompt_text,
+ const DialogClosedCallback& callback) {
+ JavaScriptDialogPresenter* presenter =
+ delegate_ ? delegate_->GetJavaScriptDialogPresenter(this) : nullptr;
+ if (!presenter) {
+ callback.Run(false, nil);
+ return;
+ }
+ presenter->RunJavaScriptDialog(this, origin_url, javascript_dialog_type,
+ message_text, default_prompt_text, callback);
+}
+
+void WebStateImpl::CancelActiveAndPendingDialogs() {
+ if (delegate_) {
+ JavaScriptDialogPresenter* presenter =
+ delegate_->GetJavaScriptDialogPresenter(this);
+ if (presenter) {
+ presenter->CancelActiveAndPendingDialogs(this);
+ }
+ }
+}
+
WebUIIOS* WebStateImpl::CreateWebUIIOS(const GURL& url) {
WebUIIOSControllerFactory* factory =
WebUIIOSControllerFactoryRegistry::GetInstance();
« no previous file with comments | « ios/web/web_state/web_state_impl.h ('k') | ios/web/web_state/web_state_impl_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698