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

Unified Diff: ios/web/web_state/web_state_impl.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 side-by-side diff with in-line comments
Download patch
Index: ios/web/web_state/web_state_impl.h
diff --git a/ios/web/web_state/web_state_impl.h b/ios/web/web_state/web_state_impl.h
index 776416c8e6baf81801535d5ca304b9a8be403ef4..d670e805ffbb1e3c10d4749b424039d2cc1a8d6f 100644
--- a/ios/web/web_state/web_state_impl.h
+++ b/ios/web/web_state/web_state_impl.h
@@ -20,7 +20,9 @@
#include "ios/web/navigation/navigation_manager_delegate.h"
#include "ios/web/navigation/navigation_manager_impl.h"
#include "ios/web/net/request_tracker_impl.h"
+#include "ios/web/public/javascript_message_type.h"
#include "ios/web/public/web_state/web_state.h"
+#include "net/base/auth.h"
#include "url/gurl.h"
@protocol CRWRequestTrackerDelegate;
@@ -267,6 +269,32 @@ class WebStateImpl : public WebState, public NavigationManagerDelegate {
// Notifies the delegate that a context menu needs handling.
bool HandleContextMenu(const ContextMenuParams& params);
+ // Callback for |RunJavaScrriptDialog|. The |success| value is true if the
+ // user responded with OK, |false| if the prompt was cancelled. The
+ // |user_input| value will exist for prompt alerts only.
+ typedef base::Callback<void(bool success, NSString* user_input)>
+ DialogClosedCallback;
Eugene But (OOO till 7-30) 2016/06/24 17:04:53 This looks exactly like a callback from DialogPres
michaeldo 2016/06/27 20:30:10 I went with the duplication based on other callbac
+ // Notifies the delegate that a Javascript message needs handling.
Eugene But (OOO till 7-30) 2016/06/24 17:04:52 s/Javascript message needs handling/JavaScript dia
michaeldo 2016/06/27 20:30:10 Done.
+ void RunJavaScriptDialog(const GURL& origin_URL,
Eugene But (OOO till 7-30) 2016/06/24 17:04:53 s/origin_URL/origin_url
michaeldo 2016/06/27 20:30:10 replaced with "origin" based on your previous comm
+ JavaScriptMessageType javascript_message_type,
+ NSString* message_text,
+ NSString* default_prompt_text,
+ const DialogClosedCallback& callback);
+
+ // Callback for |RunAuthDialog|. If empty values are provided, the login will
+ // be rejected.
+ typedef base::Callback<void(const net::AuthCredentials& credentials)>
+ AuthDialogCallback;
Eugene But (OOO till 7-30) 2016/06/24 17:04:52 Same question. Is there a way to share this code?
michaeldo 2016/06/27 20:30:10 This code is no longer part of this CL.
+ // Notifies the delegate that a response is needed to an HTTP Authentication
+ // prompt.
+ void RunAuthDialog(NSURLProtectionSpace* protectionSpace,
+ NSURLCredential* credential,
+ const AuthDialogCallback& callback);
+
+ // Cancels the display of any currently displayed dialog and any queued
+ // dialogs.
+ void CancelActiveAndPendingDialogs();
+
// NavigationManagerDelegate:
void NavigateToPendingEntry() override;
void LoadURLWithParams(const NavigationManager::WebLoadParams&) override;

Powered by Google App Engine
This is Rietveld 408576698