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

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

Issue 2737943003: Moved window opening callback to WebStateDelegate. (Closed)
Patch Set: Rebased 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
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
20 // user. |webState| will not open a window if this method returns nil. This
21 // method can not return |webState|.
22 - (web::WebState*)webState:(web::WebState*)webState
23 createNewWebStateForURL:(const GURL&)URL
24 openerURL:(const GURL&)openerURL
25 initiatedByUser:(BOOL)initiatedByUser;
26
17 // Returns the WebState the URL is opened in, or nullptr if the URL wasn't 27 // Returns the WebState the URL is opened in, or nullptr if the URL wasn't
18 // opened immediately. 28 // opened immediately.
19 - (web::WebState*)webState:(web::WebState*)webState 29 - (web::WebState*)webState:(web::WebState*)webState
20 openURLWithParams:(const web::WebState::OpenURLParams&)params; 30 openURLWithParams:(const web::WebState::OpenURLParams&)params;
21 31
22 // Called when the user triggers the context menu with the given 32 // Called when the user triggers the context menu with the given
23 // |ContextMenuParams|. Returns YES if the context menu operation was 33 // |ContextMenuParams|. Returns YES if the context menu operation was
24 // handled by the delegate. If this method is not implemented, the system 34 // handled by the delegate. If this method is not implemented, the system
25 // context menu will be displayed. 35 // context menu will be displayed.
26 - (BOOL)webState:(web::WebState*)webState 36 - (BOOL)webState:(web::WebState*)webState
(...skipping 23 matching lines...) Expand all
50 60
51 namespace web { 61 namespace web {
52 62
53 // Adapter to use an id<CRWWebStateDelegate> as a web::WebStateDelegate. 63 // Adapter to use an id<CRWWebStateDelegate> as a web::WebStateDelegate.
54 class WebStateDelegateBridge : public web::WebStateDelegate { 64 class WebStateDelegateBridge : public web::WebStateDelegate {
55 public: 65 public:
56 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate); 66 explicit WebStateDelegateBridge(id<CRWWebStateDelegate> delegate);
57 ~WebStateDelegateBridge() override; 67 ~WebStateDelegateBridge() override;
58 68
59 // web::WebStateDelegate methods. 69 // web::WebStateDelegate methods.
70 WebState* CreateNewWebState(WebState* source,
71 const GURL& url,
72 const GURL& opener_url,
73 bool initiated_by_user) override;
60 WebState* OpenURLFromWebState(WebState*, 74 WebState* OpenURLFromWebState(WebState*,
61 const WebState::OpenURLParams&) override; 75 const WebState::OpenURLParams&) override;
62 bool HandleContextMenu(WebState* source, 76 bool HandleContextMenu(WebState* source,
63 const ContextMenuParams& params) override; 77 const ContextMenuParams& params) override;
64 void ShowRepostFormWarningDialog( 78 void ShowRepostFormWarningDialog(
65 WebState* source, 79 WebState* source,
66 const base::Callback<void(bool)>& callback) override; 80 const base::Callback<void(bool)>& callback) override;
67 JavaScriptDialogPresenter* GetJavaScriptDialogPresenter( 81 JavaScriptDialogPresenter* GetJavaScriptDialogPresenter(
68 WebState* source) override; 82 WebState* source) override;
69 void OnAuthRequired(WebState* source, 83 void OnAuthRequired(WebState* source,
70 NSURLProtectionSpace* protection_space, 84 NSURLProtectionSpace* protection_space,
71 NSURLCredential* proposed_credential, 85 NSURLCredential* proposed_credential,
72 const AuthCallback& callback) override; 86 const AuthCallback& callback) override;
73 87
74 private: 88 private:
75 // CRWWebStateDelegate which receives forwarded calls. 89 // CRWWebStateDelegate which receives forwarded calls.
76 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_; 90 base::WeakNSProtocol<id<CRWWebStateDelegate>> delegate_;
77 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge); 91 DISALLOW_COPY_AND_ASSIGN(WebStateDelegateBridge);
78 }; 92 };
79 93
80 } // web 94 } // web
81 95
82 #endif // IOS_WEB_PUBLIC_WEB_STATE_WEB_STATE_DELEGATE_BRIDGE_H_ 96 #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