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

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: 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 side-by-side diff with in-line comments
Download patch
« ios/web/web_state/web_state_impl.h ('K') | « ios/web/web_state/web_state_impl.h ('k') | no next file » | 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..37a85770b91a24664fefc1772933f6d9cf28dfb0 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"
+#include "ios/web/public/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,45 @@ bool WebStateImpl::HandleContextMenu(const web::ContextMenuParams& params) {
return false;
}
+void WebStateImpl::RunJavaScriptDialog(
+ const GURL& origin_url,
+ JavaScriptMessageType javascript_message_type,
+ NSString* message_text,
+ NSString* default_prompt_text,
+ const DialogClosedCallback& callback) {
+ if (!delegate_) {
+ callback.Run(false, nil);
+ return;
+ }
+ DialogPresenter* presenter = delegate_->GetDialogPresenter(this);
+ if (presenter) {
+ presenter->RunJavaScriptDialog(this, origin_url, javascript_message_type,
+ message_text, default_prompt_text, callback);
+ }
Eugene But (OOO till 7-30) 2016/06/24 17:04:53 I would expect a crash if GetDialogPresenter retur
michaeldo 2016/06/27 20:30:10 Done.
+}
+
+void WebStateImpl::RunAuthDialog(NSURLProtectionSpace* protectionSpace,
+ NSURLCredential* credential,
+ const AuthDialogCallback& callback) {
+ if (!delegate_) {
+ callback.Run(net::AuthCredentials());
+ return;
+ }
+ DialogPresenter* presenter = delegate_->GetDialogPresenter(this);
+ if (presenter) {
+ presenter->RunAuthDialog(this, protectionSpace, credential, callback);
+ }
+}
+
+void WebStateImpl::CancelActiveAndPendingDialogs() {
+ if (delegate_) {
+ DialogPresenter* presenter = delegate_->GetDialogPresenter(this);
+ if (presenter) {
+ presenter->CancelActiveAndPendingDialogs(this);
+ }
+ }
+}
+
WebUIIOS* WebStateImpl::CreateWebUIIOS(const GURL& url) {
WebUIIOSControllerFactory* factory =
WebUIIOSControllerFactoryRegistry::GetInstance();
« ios/web/web_state/web_state_impl.h ('K') | « ios/web/web_state/web_state_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698