Refactor management of overview window copy lifetime into a separate class.
[chromium-blink-merge.git] / content / shell / browser / shell_javascript_dialog.h
blob4001334c788fdde535e342b7dc7fe519df247db8
1 // Copyright 2013 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.
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_
8 #include "content/public/browser/javascript_dialog_manager.h"
10 #if defined(TOOLKIT_GTK)
11 #include "ui/base/gtk/gtk_signal.h"
12 #endif
14 #if defined(OS_MACOSX)
15 #if __OBJC__
16 @class ShellJavaScriptDialogHelper;
17 #else
18 class ShellJavaScriptDialogHelper;
19 #endif // __OBJC__
20 #endif // defined(OS_MACOSX)
22 namespace content {
24 class ShellJavaScriptDialogManager;
26 class ShellJavaScriptDialog {
27 public:
28 ShellJavaScriptDialog(
29 ShellJavaScriptDialogManager* manager,
30 gfx::NativeWindow parent_window,
31 JavaScriptMessageType message_type,
32 const string16& message_text,
33 const string16& default_prompt_text,
34 const JavaScriptDialogManager::DialogClosedCallback& callback);
35 ~ShellJavaScriptDialog();
37 // Called to cancel a dialog mid-flight.
38 void Cancel();
40 private:
41 ShellJavaScriptDialogManager* manager_;
42 JavaScriptDialogManager::DialogClosedCallback callback_;
44 #if defined(OS_MACOSX)
45 ShellJavaScriptDialogHelper* helper_; // owned
46 #elif defined(OS_WIN)
47 JavaScriptMessageType message_type_;
48 HWND dialog_win_;
49 string16 message_text_;
50 string16 default_prompt_text_;
51 static INT_PTR CALLBACK DialogProc(HWND dialog, UINT message, WPARAM wparam,
52 LPARAM lparam);
53 #elif defined(TOOLKIT_GTK)
54 GtkWidget* gtk_dialog_;
55 gfx::NativeWindow parent_window_;
56 CHROMEGTK_CALLBACK_1(ShellJavaScriptDialog, void, OnResponse, int);
57 #endif
59 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialog);
62 } // namespace content
64 #endif // CONTENT_SHELL_BROWSER_SHELL_JAVASCRIPT_DIALOG_H_