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/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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 5 #ifndef IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_
6 #define IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 6 #define IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/observer_list.h" 18 #include "base/observer_list.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "ios/web/navigation/navigation_manager_delegate.h" 20 #include "ios/web/navigation/navigation_manager_delegate.h"
21 #include "ios/web/navigation/navigation_manager_impl.h" 21 #include "ios/web/navigation/navigation_manager_impl.h"
22 #include "ios/web/net/request_tracker_impl.h" 22 #include "ios/web/net/request_tracker_impl.h"
23 #include "ios/web/public/javascript_message_type.h"
23 #include "ios/web/public/web_state/web_state.h" 24 #include "ios/web/public/web_state/web_state.h"
25 #include "net/base/auth.h"
24 #include "url/gurl.h" 26 #include "url/gurl.h"
25 27
26 @protocol CRWRequestTrackerDelegate; 28 @protocol CRWRequestTrackerDelegate;
27 @class CRWWebController; 29 @class CRWWebController;
28 @protocol CRWWebViewProxy; 30 @protocol CRWWebViewProxy;
29 @class NSURLRequest; 31 @class NSURLRequest;
30 @class NSURLResponse; 32 @class NSURLResponse;
31 33
32 namespace net { 34 namespace net {
33 class HttpResponseHeaders; 35 class HttpResponseHeaders;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 void ShowWebInterstitial(WebInterstitialImpl* interstitial); 262 void ShowWebInterstitial(WebInterstitialImpl* interstitial);
261 263
262 // Called to dismiss the currently-displayed transient content view. 264 // Called to dismiss the currently-displayed transient content view.
263 void ClearTransientContentView(); 265 void ClearTransientContentView();
264 266
265 // Notifies the delegate that the load progress was updated. 267 // Notifies the delegate that the load progress was updated.
266 void SendChangeLoadProgress(double progress); 268 void SendChangeLoadProgress(double progress);
267 // Notifies the delegate that a context menu needs handling. 269 // Notifies the delegate that a context menu needs handling.
268 bool HandleContextMenu(const ContextMenuParams& params); 270 bool HandleContextMenu(const ContextMenuParams& params);
269 271
272 // Callback for |RunJavaScrriptDialog|. The |success| value is true if the
273 // user responded with OK, |false| if the prompt was cancelled. The
274 // |user_input| value will exist for prompt alerts only.
275 typedef base::Callback<void(bool success, NSString* user_input)>
276 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
277 // 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.
278 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
279 JavaScriptMessageType javascript_message_type,
280 NSString* message_text,
281 NSString* default_prompt_text,
282 const DialogClosedCallback& callback);
283
284 // Callback for |RunAuthDialog|. If empty values are provided, the login will
285 // be rejected.
286 typedef base::Callback<void(const net::AuthCredentials& credentials)>
287 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.
288 // Notifies the delegate that a response is needed to an HTTP Authentication
289 // prompt.
290 void RunAuthDialog(NSURLProtectionSpace* protectionSpace,
291 NSURLCredential* credential,
292 const AuthDialogCallback& callback);
293
294 // Cancels the display of any currently displayed dialog and any queued
295 // dialogs.
296 void CancelActiveAndPendingDialogs();
297
270 // NavigationManagerDelegate: 298 // NavigationManagerDelegate:
271 void NavigateToPendingEntry() override; 299 void NavigateToPendingEntry() override;
272 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override; 300 void LoadURLWithParams(const NavigationManager::WebLoadParams&) override;
273 void OnNavigationItemsPruned(size_t pruned_item_count) override; 301 void OnNavigationItemsPruned(size_t pruned_item_count) override;
274 void OnNavigationItemChanged() override; 302 void OnNavigationItemChanged() override;
275 void OnNavigationItemCommitted( 303 void OnNavigationItemCommitted(
276 const LoadCommittedDetails& load_details) override; 304 const LoadCommittedDetails& load_details) override;
277 WebState* GetWebState() override; 305 WebState* GetWebState() override;
278 306
279 protected: 307 protected:
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 387
360 // Mojo interface registry for this WebState. 388 // Mojo interface registry for this WebState.
361 std::unique_ptr<shell::InterfaceRegistry> mojo_interface_registry_; 389 std::unique_ptr<shell::InterfaceRegistry> mojo_interface_registry_;
362 390
363 DISALLOW_COPY_AND_ASSIGN(WebStateImpl); 391 DISALLOW_COPY_AND_ASSIGN(WebStateImpl);
364 }; 392 };
365 393
366 } // namespace web 394 } // namespace web
367 395
368 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_ 396 #endif // IOS_WEB_WEB_STATE_WEB_STATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698