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

Side by Side Diff: ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/java_script_dialog_overlay_presenter.h

Issue 2928723002: [iOS Clean] Added JavaScript dialog support.
Patch Set: rebase & Mark's comments Created 3 years, 6 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_WEB_JAVA_SCRIPT_DIALOG_P RESENTER_H_
6 #define IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_WEB_JAVA_SCRIPT_DIALOG_P RESENTER_H_
7
8 #import <Foundation/Foundation.h>
9
10 #include "ios/web/public/java_script_dialog_presenter.h"
11 #import "ios/web/public/web_state/web_state_user_data.h"
12
13 class OverlayService;
14
15 // A concrete subclass of web::JavaScriptDialogPresenter that is associated with
16 // a WebState via its UserData. It uses OverlayService to present dialogs.
17 class JavaScriptDialogOverlayPresenter
18 : public web::JavaScriptDialogPresenter,
19 public web::WebStateUserData<JavaScriptDialogOverlayPresenter> {
20 public:
21 // Factory method for a presenter that uses |overlay_service| to show dialogs.
22 static void CreateForWebState(web::WebState* web_state,
23 OverlayService* overlay_service);
24
25 ~JavaScriptDialogOverlayPresenter() override;
26
27 private:
28 friend class web::WebStateUserData<JavaScriptDialogOverlayPresenter>;
29 // The WebState with which this presenter is associated.
30 web::WebState* web_state_;
31 // The OverlayService to use for the dialogs.
32 OverlayService* overlay_service_;
33
34 // Private constructor. New instances should be created via
35 // CreateForWebState() and accessed via FromWebState().
36 explicit JavaScriptDialogOverlayPresenter(web::WebState* web_state,
37 OverlayService* overlay_service);
38
39 // JavaScriptDialogPresenter:
40 void RunJavaScriptDialog(web::WebState* web_state,
41 const GURL& origin_url,
42 web::JavaScriptDialogType dialog_type,
43 NSString* message_text,
44 NSString* default_prompt_text,
45 const web::DialogClosedCallback& callback) override;
46 void CancelDialogs(web::WebState* web_state) override;
47
48 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogOverlayPresenter);
49 };
50
51 #endif // IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_WEB_JAVA_SCRIPT_DIALO G_PRESENTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698