1 // 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.
5 #ifndef CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_DIALOG_VIEWS_H_
6 #define CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_DIALOG_VIEWS_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
10 #include "ui/views/window/dialog_delegate.h"
12 class JavaScriptAppModalDialog
;
14 #if defined(USE_X11) && !defined(OS_CHROMEOS)
15 class JavascriptAppModalEventBlockerX11
;
22 class JavaScriptAppModalDialogViews
: public NativeAppModalDialog
,
23 public views::DialogDelegate
{
25 explicit JavaScriptAppModalDialogViews(JavaScriptAppModalDialog
* parent
);
26 virtual ~JavaScriptAppModalDialogViews();
28 // Overridden from NativeAppModalDialog:
29 virtual int GetAppModalDialogButtons() const OVERRIDE
;
30 virtual void ShowAppModalDialog() OVERRIDE
;
31 virtual void ActivateAppModalDialog() OVERRIDE
;
32 virtual void CloseAppModalDialog() OVERRIDE
;
33 virtual void AcceptAppModalDialog() OVERRIDE
;
34 virtual void CancelAppModalDialog() OVERRIDE
;
36 // Overridden from views::DialogDelegate:
37 virtual int GetDefaultDialogButton() const OVERRIDE
;
38 virtual int GetDialogButtons() const OVERRIDE
;
39 virtual base::string16
GetWindowTitle() const OVERRIDE
;
40 virtual void WindowClosing() OVERRIDE
;
41 virtual void DeleteDelegate() OVERRIDE
;
42 virtual bool Cancel() OVERRIDE
;
43 virtual bool Accept() OVERRIDE
;
44 virtual base::string16
GetDialogButtonLabel(
45 ui::DialogButton button
) const OVERRIDE
;
47 // Overridden from views::WidgetDelegate:
48 virtual ui::ModalType
GetModalType() const OVERRIDE
;
49 virtual views::View
* GetContentsView() OVERRIDE
;
50 virtual views::View
* GetInitiallyFocusedView() OVERRIDE
;
51 virtual void OnClosed() OVERRIDE
;
52 virtual views::Widget
* GetWidget() OVERRIDE
;
53 virtual const views::Widget
* GetWidget() const OVERRIDE
;
56 // A pointer to the AppModalDialog that owns us.
57 scoped_ptr
<JavaScriptAppModalDialog
> parent_
;
59 // The message box view whose commands we handle.
60 views::MessageBoxView
* message_box_view_
;
62 #if defined(USE_X11) && !defined(OS_CHROMEOS)
63 // Blocks events to other browser windows while the dialog is open.
64 scoped_ptr
<JavascriptAppModalEventBlockerX11
> event_blocker_x11_
;
67 DISALLOW_COPY_AND_ASSIGN(JavaScriptAppModalDialogViews
);
70 #endif // CHROME_BROWSER_UI_VIEWS_JAVASCRIPT_APP_MODAL_DIALOG_VIEWS_H_