blob: b819f3bd9e90b5a3c822bb0661f83fbac1747f6f [file] [log] [blame]
[email protected]f2210022012-03-29 00:36:081// Copyright (c) 2012 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 CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_
6#define CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_
[email protected]f2210022012-03-29 00:36:087
[email protected]71a88bb2013-02-01 22:05:158#include "content/public/browser/javascript_dialog_manager.h"
[email protected]f2210022012-03-29 00:36:089
[email protected]fc4f4dd42012-07-30 20:52:4810#if defined(TOOLKIT_GTK)
11#include "ui/base/gtk/gtk_signal.h"
12#endif
13
[email protected]f2210022012-03-29 00:36:0814#if defined(OS_MACOSX)
15#if __OBJC__
[email protected]f2210022012-03-29 00:36:0816@class ShellJavaScriptDialogHelper;
17#else
[email protected]f2210022012-03-29 00:36:0818class ShellJavaScriptDialogHelper;
19#endif // __OBJC__
20#endif // defined(OS_MACOSX)
21
22namespace content {
23
[email protected]71a88bb2013-02-01 22:05:1524class ShellJavaScriptDialogManager;
[email protected]f2210022012-03-29 00:36:0825
26class ShellJavaScriptDialog {
27 public:
28 ShellJavaScriptDialog(
[email protected]71a88bb2013-02-01 22:05:1529 ShellJavaScriptDialogManager* manager,
[email protected]fc4f4dd42012-07-30 20:52:4830 gfx::NativeWindow parent_window,
[email protected]be2510c02012-05-28 14:52:1431 JavaScriptMessageType message_type,
[email protected]f2210022012-03-29 00:36:0832 const string16& message_text,
33 const string16& default_prompt_text,
[email protected]71a88bb2013-02-01 22:05:1534 const JavaScriptDialogManager::DialogClosedCallback& callback);
[email protected]f2210022012-03-29 00:36:0835 ~ShellJavaScriptDialog();
36
37 // Called to cancel a dialog mid-flight.
38 void Cancel();
39
40 private:
[email protected]71a88bb2013-02-01 22:05:1541 ShellJavaScriptDialogManager* manager_;
42 JavaScriptDialogManager::DialogClosedCallback callback_;
[email protected]f2210022012-03-29 00:36:0843
44#if defined(OS_MACOSX)
45 ShellJavaScriptDialogHelper* helper_; // owned
[email protected]7fc83822012-03-30 19:53:2946#elif defined(OS_WIN)
[email protected]be2510c02012-05-28 14:52:1447 JavaScriptMessageType message_type_;
[email protected]7fc83822012-03-30 19:53:2948 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);
[email protected]fc4f4dd42012-07-30 20:52:4853#elif defined(TOOLKIT_GTK)
54 GtkWidget* gtk_dialog_;
55 gfx::NativeWindow parent_window_;
56 CHROMEGTK_CALLBACK_1(ShellJavaScriptDialog, void, OnResponse, int);
[email protected]7fc83822012-03-30 19:53:2957#endif
[email protected]f2210022012-03-29 00:36:0858
59 DISALLOW_COPY_AND_ASSIGN(ShellJavaScriptDialog);
60};
61
62} // namespace content
63
64#endif // CONTENT_SHELL_SHELL_JAVASCRIPT_DIALOG_H_