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

Side by Side Diff: ios/web/public/web_state/web_state_delegate_bridge.h

Issue 2737353006: Replaced webPageOrderedClose with WebStateDelegate API. (Closed)
Patch Set: Addressed review comments Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ 5 #ifndef IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_
6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ 6 #define IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #import "base/ios/weak_nsobject.h" 10 #import "base/ios/weak_nsobject.h"
11 #import "ios/web/public/web_state/web_state_delegate.h" 11 #import "ios/web/public/web_state/web_state_delegate.h"
12 12
13 // Objective-C interface for web::WebStateDelegate. 13 // Objective-C interface for web::WebStateDelegate.
14 @protocol CRWWebStateDelegate<NSObject> 14 @protocol CRWWebStateDelegate<NSObject>
15 @optional 15 @optional
16 16
17 // Called when |webState| wants to open a new window. |url| is the URL of 17 // Called when |webState| wants to open a new window. |url| is the URL of
18 // the new window; |opener_url| is the URL of the page which requested a 18 // the new window; |opener_url| is the URL of the page which requested a
19 // window to be open; |initiated_by_user| is true if action was caused by the 19 // window to be open; |initiated_by_user| is true if action was caused by the
20 // user. |webState| will not open a window if this method returns nil. This 20 // user. |webState| will not open a window if this method returns nil. This
21 // method can not return |webState|. 21 // method can not return |webState|.
22 - (web::WebState*)webState:(web::WebState*)webState 22 - (web::WebState*)webState:(web::WebState*)webState
23 createNewWebStateForURL:(const GURL&)URL 23 createNewWebStateForURL:(const GURL&)URL
24 openerURL:(const GURL&)openerURL 24 openerURL:(const GURL&)openerURL
25 initiatedByUser:(BOOL)initiatedByUser; 25 initiatedByUser:(BOOL)initiatedByUser;
26 26
27 // Called when the page calls wants to close self by calling window.close()
28 // JavaScript API.
29 - (void)closeWebState:(web::WebState*)webState;
30
27 // Returns the WebState the URL is opened in, or nullptr if the URL wasn't 31 // Returns the WebState the URL is opened in, or nullptr if the URL wasn't
28 // opened immediately. 32 // opened immediately.
29 - (web::WebState*)webState:(web::WebState*)webState 33 - (web::WebState*)webState:(web::WebState*)webState
30 openURLWithParams:(const web::WebState::OpenURLParams&)params; 34 openURLWithParams:(const web::WebState::OpenURLParams&)params;
31 35
32 // Called when the user triggers the context menu with the given 36 // Called when the user triggers the context menu with the given
33 // |ContextMenuParams|. Returns YES if the context menu operation was 37 // |ContextMenuParams|. Returns YES if the context menu operation was
34 // handled by the delegate. If this method is not implemented, the system 38 // handled by the delegate. If this method is not implemented, the system
35 // context menu will be displayed. 39 // context menu will be displayed.
36 - (BOOL)webState:(web::WebState*)webState 40 - (BOOL)webState:(web::WebState*)webState
(...skipping 27 matching lines...) Expand all
64 class WebStateDelegateBridge : public web::WebStateDelegate { 68 class WebStateDelegateBridge : public web::WebStateDelegate {
65 public: 69 public:
66 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate); 70 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate);
67 ~WebStateDelegateBridge() override; 71 ~WebStateDelegateBridge() override;
68 72
69 // web::WebStateDelegate methods. 73 // web::WebStateDelegate methods.
70 WebState* CreateNewWebState(WebState* source, 74 WebState* CreateNewWebState(WebState* source,
71 const GURL& url, 75 const GURL& url,
72 const GURL& opener_url, 76 const GURL& opener_url,
73 bool initiated_by_user) override; 77 bool initiated_by_user) override;
78 void CloseWebState(WebState* source) override;
74 WebState* OpenURLFromWebState(WebState*, 79 WebState* OpenURLFromWebState(WebState*,
75 const WebState::OpenURLParams&) override; 80 const WebState::OpenURLParams&) override;
76 bool HandleContextMenu(WebState* source, 81 bool HandleContextMenu(WebState* source,
77 const ContextMenuParams& params) override; 82 const ContextMenuParams& params) override;
78 void ShowRepostFormWarningDialog( 83 void ShowRepostFormWarningDialog(
79 WebState* source, 84 WebState* source,
80 const base::Callback<void(bool)>& callback) override; 85 const base::Callback<void(bool)>& callback) override;
81 JavaScriptDialogPresenter* GetJavaScriptDialogPresenter( 86 JavaScriptDialogPresenter* GetJavaScriptDialogPresenter(
82 WebState* source) override; 87 WebState* source) override;
83 void OnAuthRequired(WebState* source, 88 void OnAuthRequired(WebState* source,
84 NSURLProtectionSpace* protection_space, 89 NSURLProtectionSpace* protection_space,
85 NSURLCredential* proposed_credential, 90 NSURLCredential* proposed_credential,
86 const AuthCallback& callback) override; 91 const AuthCallback& callback) override;
87 92
88 private: 93 private:
89 // CRWWebStateDelegate which receives forwarded calls. 94 // CRWWebStateDelegate which receives forwarded calls.
90 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_; 95 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_;
91 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge); 96 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge);
92 }; 97 };
93 98
94 } // web 99 } // web
95 100
96 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ 101 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_
OLDNEW
« no previous file with comments | « ios/web/public/web_state/web_state_delegate.h ('k') | ios/web/web_state/ui/crw_web_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698