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

Side by Side Diff: ios/chrome/browser/ui/dialogs/dialog_presenter.h

Issue 2957423002: Check page URL origin to determine JavaScript alert titles. (Closed)
Patch Set: Created 3 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_CHROME_BROWSER_UI_DIALOGS_DIALOG_PRESENTER_H_ 5 #ifndef IOS_CHROME_BROWSER_UI_DIALOGS_DIALOG_PRESENTER_H_
6 #define IOS_CHROME_BROWSER_UI_DIALOGS_DIALOG_PRESENTER_H_ 6 #define IOS_CHROME_BROWSER_UI_DIALOGS_DIALOG_PRESENTER_H_
7 7
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #import "base/ios/block_types.h" 10 #import "base/ios/block_types.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 - (void)cancelDialogForWebState:(web::WebState*)webState; 70 - (void)cancelDialogForWebState:(web::WebState*)webState;
71 71
72 // Dismisses the currently presented dialog and cancels all queued dialogs. 72 // Dismisses the currently presented dialog and cancels all queued dialogs.
73 - (void)cancelAllDialogs; 73 - (void)cancelAllDialogs;
74 74
75 // Tries to present an alert if needed and possible. Called by the view 75 // Tries to present an alert if needed and possible. Called by the view
76 // controller which will present the alert to notify that it has dismissed a 76 // controller which will present the alert to notify that it has dismissed a
77 // view controller. 77 // view controller.
78 - (void)tryToPresent; 78 - (void)tryToPresent;
79 79
80 // Create an title for the alert base on the URL. 80 // Create an title for the alert base on the URL (|pageURL|). Assumes that
81 // pageURL is the mainFrameURL. (See
82 // localizedTItleForJavaScriptAlertFromPage:mainFrameURL).
81 + (NSString*)localizedTitleForJavaScriptAlertFromPage:(const GURL&)pageURL; 83 + (NSString*)localizedTitleForJavaScriptAlertFromPage:(const GURL&)pageURL;
Eugene But (OOO till 7-30) 2017/06/29 01:00:01 Do we even need this method? It is only used in EG
PL 2017/06/29 20:02:21 Sure thing! I did think about this, and whether it
82 84
85 // Create an title for the alert base on the URL (|pageURL|), and its
Eugene But (OOO till 7-30) 2017/06/29 01:00:01 s/Create/Creates
PL 2017/06/29 20:02:21 Arg, done!
86 // relationship to the |mainFrameURL| (typically these are identical except for
87 // when posting alerts from an embedded iframe).
88 + (NSString*)localizedTitleForJavaScriptAlertFromPage:(const GURL&)pageURL
Eugene But (OOO till 7-30) 2017/06/29 01:00:01 Do we even need this method in the public interfac
PL 2017/06/29 20:02:21 It's only going to be used by the EGTest, but I th
Eugene But (OOO till 7-30) 2017/06/29 20:35:10 Can we just hardcode the title in those tests? A a
89 mainFrameURL:(const GURL&)mainFrameURL;
90
83 @end 91 @end
84 92
85 @interface DialogPresenter (ExposedForTesting) 93 @interface DialogPresenter (ExposedForTesting)
86 // The dialog currently being shown. 94 // The dialog currently being shown.
87 @property(nonatomic, readonly) AlertCoordinator* presentedDialogCoordinator; 95 @property(nonatomic, readonly) AlertCoordinator* presentedDialogCoordinator;
88 96
89 // Called when |coordinator| is stopped. 97 // Called when |coordinator| is stopped.
90 - (void)dialogCoordinatorWasStopped:(AlertCoordinator*)coordinator; 98 - (void)dialogCoordinatorWasStopped:(AlertCoordinator*)coordinator;
91 99
92 @end 100 @end
93 101
94 // Delegate protocol for DialogPresenter. 102 // Delegate protocol for DialogPresenter.
95 @protocol DialogPresenterDelegate<NSObject> 103 @protocol DialogPresenterDelegate<NSObject>
96 104
97 // Called by |presenter| before showing the queued modal dialog associated with 105 // Called by |presenter| before showing the queued modal dialog associated with
98 // |context|. 106 // |context|.
99 - (void)dialogPresenter:(DialogPresenter*)presenter 107 - (void)dialogPresenter:(DialogPresenter*)presenter
100 willShowDialogForWebState:(web::WebState*)webState; 108 willShowDialogForWebState:(web::WebState*)webState;
101 109
102 // Whether the delegate is presenting another View Controller. 110 // Whether the delegate is presenting another View Controller.
103 @property(nonatomic, assign) BOOL presenting; 111 @property(nonatomic, assign) BOOL presenting;
104 112
105 @end 113 @end
106 114
107 #endif // IOS_CHROME_BROWSER_UI_DIALOGS_DIALOG_PRESENTER_H_ 115 #endif // IOS_CHROME_BROWSER_UI_DIALOGS_DIALOG_PRESENTER_H_
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/ui/dialogs/dialog_presenter.mm » ('j') | ios/chrome/browser/ui/dialogs/dialog_presenter.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698