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

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: Add string comparison unit test 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 // Creates a title for the alert base on the URL (|pageURL|), and its
81 + (NSString*)localizedTitleForJavaScriptAlertFromPage:(const GURL&)pageURL; 81 // relationship to the |mainFrameURL| (typically these are identical except for
82 // when posting alerts from an embedded iframe).
83 + (NSString*)localizedTitleForJavaScriptAlertFromPage:(const GURL&)pageURL
84 mainFrameURL:(const GURL&)mainFrameURL;
82 85
83 @end 86 @end
84 87
85 @interface DialogPresenter (ExposedForTesting) 88 @interface DialogPresenter (ExposedForTesting)
86 // The dialog currently being shown. 89 // The dialog currently being shown.
87 @property(nonatomic, readonly) AlertCoordinator* presentedDialogCoordinator; 90 @property(nonatomic, readonly) AlertCoordinator* presentedDialogCoordinator;
88 91
89 // Called when |coordinator| is stopped. 92 // Called when |coordinator| is stopped.
90 - (void)dialogCoordinatorWasStopped:(AlertCoordinator*)coordinator; 93 - (void)dialogCoordinatorWasStopped:(AlertCoordinator*)coordinator;
91 94
92 @end 95 @end
93 96
94 // Delegate protocol for DialogPresenter. 97 // Delegate protocol for DialogPresenter.
95 @protocol DialogPresenterDelegate<NSObject> 98 @protocol DialogPresenterDelegate<NSObject>
96 99
97 // Called by |presenter| before showing the queued modal dialog associated with 100 // Called by |presenter| before showing the queued modal dialog associated with
98 // |context|. 101 // |context|.
99 - (void)dialogPresenter:(DialogPresenter*)presenter 102 - (void)dialogPresenter:(DialogPresenter*)presenter
100 willShowDialogForWebState:(web::WebState*)webState; 103 willShowDialogForWebState:(web::WebState*)webState;
101 104
102 // Whether the delegate is presenting another View Controller. 105 // Whether the delegate is presenting another View Controller.
103 @property(nonatomic, assign) BOOL presenting; 106 @property(nonatomic, assign) BOOL presenting;
104 107
105 @end 108 @end
106 109
107 #endif // IOS_CHROME_BROWSER_UI_DIALOGS_DIALOG_PRESENTER_H_ 110 #endif // IOS_CHROME_BROWSER_UI_DIALOGS_DIALOG_PRESENTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698