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

Unified Diff: ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/web_java_script_dialog_presenter.h

Issue 2928723002: [iOS Clean] Added JavaScript dialog support.
Patch Set: rebased, subclassed DialogMediator 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 side-by-side diff with in-line comments
Download patch
Index: ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/web_java_script_dialog_presenter.h
diff --git a/ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/web_java_script_dialog_presenter.h b/ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/web_java_script_dialog_presenter.h
new file mode 100644
index 0000000000000000000000000000000000000000..677a4ee995b5376545b361e388d946e129b433af
--- /dev/null
+++ b/ios/clean/chrome/browser/ui/dialogs/java_script_dialogs/web_java_script_dialog_presenter.h
@@ -0,0 +1,42 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_WEB_JAVA_SCRIPT_DIALOG_PRESENTER_H_
+#define IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_WEB_JAVA_SCRIPT_DIALOG_PRESENTER_H_
+
+#import <Foundation/Foundation.h>
+
+#include "ios/web/public/java_script_dialog_presenter.h"
+#import "ios/web/public/web_state/web_state_user_data.h"
+
+// A concrete subclass of web::JavaScriptDialogPresenter that is associated with
+// a WebState via its UserData.
+class WebJavaScriptDialogPresenter
marq (ping after 24h) 2017/06/14 11:28:39 I suspect naming this "WebFoo" when it isn't in io
kkhorimoto 2017/06/23 06:34:03 I'm also not a fan. I renamed it to JavaScriptDial
+ : public web::JavaScriptDialogPresenter,
+ public web::WebStateUserData<WebJavaScriptDialogPresenter> {
+ public:
+ ~WebJavaScriptDialogPresenter() override;
+
+ private:
+ friend class web::WebStateUserData<WebJavaScriptDialogPresenter>;
+ // The WebState with which this presenter is associated.
+ web::WebState* web_state_;
+
+ // Private constructor. New instances should be created via
+ // CreateForWebState() and accessed via FromWebState().
+ explicit WebJavaScriptDialogPresenter(web::WebState* web_state);
+
+ // JavaScriptDialogPresenter:
+ void RunJavaScriptDialog(web::WebState* web_state,
+ const GURL& origin_url,
+ web::JavaScriptDialogType dialog_type,
+ NSString* message_text,
+ NSString* default_prompt_text,
+ const web::DialogClosedCallback& callback) override;
+ void CancelDialogs(web::WebState* web_state) override;
+
+ DISALLOW_COPY_AND_ASSIGN(WebJavaScriptDialogPresenter);
+};
+
+#endif // IOS_CLEAN_CHROME_BROWSER_UI_DIALOGS_JAVA_SCRIPT_WEB_JAVA_SCRIPT_DIALOG_PRESENTER_H_

Powered by Google App Engine
This is Rietveld 408576698