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

Side by Side Diff: chrome/browser/ui/javascript_dialogs/javascript_dialog_cocoa.h

Issue 2450173003: Add a Cocoa version of the auto-dismissing dialog. (Closed)
Patch Set: rsesek Created 4 years, 1 month 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 2016 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 CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_
6 #define CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog.h"
12 #include "content/public/browser/javascript_dialog_manager.h"
13
14 // A Cocoa version of a JavaScript dialog that automatically dismisses itself
15 // when the user switches away to a different tab, used for WebContentses that
16 // are browser tabs.
17 class JavaScriptDialogCocoa : public JavaScriptDialog {
18 public:
19 class JavaScriptDialogCocoaImpl;
20
21 ~JavaScriptDialogCocoa() override;
22
23 static base::WeakPtr<JavaScriptDialogCocoa> Create(
24 content::WebContents* parent_web_contents,
25 content::WebContents* alerting_web_contents,
26 const base::string16& title,
27 content::JavaScriptMessageType message_type,
28 const base::string16& message_text,
29 const base::string16& default_prompt_text,
30 const content::JavaScriptDialogManager::DialogClosedCallback&
31 dialog_callback);
32
33 // JavaScriptDialog:
34 void CloseDialogWithoutCallback() override;
35
36 private:
37 JavaScriptDialogCocoa(
38 content::WebContents* parent_web_contents,
39 content::WebContents* alerting_web_contents,
40 const base::string16& title,
41 content::JavaScriptMessageType message_type,
42 const base::string16& message_text,
43 const base::string16& default_prompt_text,
44 const content::JavaScriptDialogManager::DialogClosedCallback&
45 dialog_callback);
46
47 std::unique_ptr<JavaScriptDialogCocoaImpl> impl_;
48
49 base::WeakPtrFactory<JavaScriptDialogCocoa> weak_factory_;
50
51 DISALLOW_COPY_AND_ASSIGN(JavaScriptDialogCocoa);
52 };
53
54 #endif // CHROME_BROWSER_UI_JAVASCRIPT_DIALOGS_JAVASCRIPT_DIALOG_COCOA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698