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

Unified Diff: ios/web/public/web_state/ui/crw_web_delegate.h

Issue 2692803004: Refactor callbacks for opening a new window. (Closed)
Patch Set: Addressed review comment Created 3 years, 10 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/public/web_state/ui/crw_web_delegate.h
diff --git a/ios/web/public/web_state/ui/crw_web_delegate.h b/ios/web/public/web_state/ui/crw_web_delegate.h
index d64f80440d08e8600d37124106b85985afba12c2..4069c877734b3919820be8f5b946faaca2e2b355 100644
--- a/ios/web/public/web_state/ui/crw_web_delegate.h
+++ b/ios/web/public/web_state/ui/crw_web_delegate.h
@@ -21,32 +21,12 @@ class GURL;
@class CRWSessionEntry;
@class CRWWebController;
-namespace web {
-class BlockedPopupInfo;
-struct Referrer;
-}
-
// Methods implemented by the delegate of the CRWWebController.
// DEPRECATED, do not conform to this protocol and do not add any methods to it.
// Use web::WebStateDelegate instead.
// TODO(crbug.com/674991): Remove this protocol.
@protocol CRWWebDelegate<NSObject>
-// Called when the page wants to open a new window by DOM (e.g. with
-// |window.open| JavaScript call or by clicking a link with |_blank| target) or
-// wants to open a window with a new tab. |inBackground| allows a page to force
-// a new window to open in the background. CRWSessionController's openedByDOM
-// property of the returned CRWWebController must be YES.
-- (CRWWebController*)webPageOrderedOpen:(const GURL&)url
- referrer:(const web::Referrer&)referrer
- windowName:(NSString*)windowName
- inBackground:(BOOL)inBackground;
-
-// Called when the page wants to open a new window by DOM.
-// CRWSessionController's openedByDOM property of the returned CRWWebController
-// must be YES.
-- (CRWWebController*)webPageOrderedOpen;
-
// Called when the page calls window.close() on itself. Begin the shut-down
// sequence for this controller.
- (void)webPageOrderedClose;
@@ -103,6 +83,16 @@ struct Referrer;
- (void)webWillFinishHistoryNavigationFromEntry:(CRWSessionEntry*)fromEntry;
// ---------------------------------------------------------------------
+// Called when |webController| wants to open a new window. |URL| is the URL of
+// the new window; |openerURL| is the URL of the page which requested a window
+// to be open; |initiatedByUser| is YES if action was caused by the user.
+// |webController| will not open a window if this method returns nil. This
+// method can not return |webController|.
+- (CRWWebController*)webController:(CRWWebController*)webController
+ createWebControllerForURL:(const GURL&)URL
+ openerURL:(const GURL&)openerURL
+ initiatedByUser:(BOOL)initiatedByUser;
+
@optional
// Called to ask CRWWebDelegate if |CRWWebController| should open the given URL.
@@ -140,20 +130,6 @@ struct Referrer;
- (void)webController:(CRWWebController*)webController
titleDidChange:(NSString*)title;
-// Called when CRWWebController has detected a popup. If NO is returned then
-// popup will be shown, otherwise |webController:didBlockPopup:| will be called
-// and CRWWebDelegate will have a chance to unblock the popup later. NO is
-// assumed by default if this method is not implemented.
-- (BOOL)webController:(CRWWebController*)webController
- shouldBlockPopupWithURL:(const GURL&)popupURL
- sourceURL:(const GURL&)sourceURL;
-
-// Called when CRWWebController has detected and blocked a popup. In order to
-// allow the blocked pop up CRWWebDelegate must call
-// |blockedPopupInfo.ShowPopup()| instead of attempting to open a new window.
-- (void)webController:(CRWWebController*)webController
- didBlockPopup:(const web::BlockedPopupInfo&)blockedPopupInfo;
-
// Called when CRWWebController did suppress a dialog (JavaScript, HTTP
// authentication or window.open).
// NOTE: Called only if CRWWebController.shouldSuppressDialogs is set to YES.

Powered by Google App Engine
This is Rietveld 408576698