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

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

Powered by Google App Engine
This is Rietveld 408576698