OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 12 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
13 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 13 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
14 #include "ui/base/gtk/gtk_signal.h" | 14 #include "ui/base/gtk/gtk_signal.h" |
15 | 15 |
16 class TabModalConfirmDialogDelegate; | 16 class TabModalConfirmDialogDelegate; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class WebContents; | 19 class WebContents; |
20 } | 20 } |
21 | 21 |
22 // Displays a tab-modal dialog, i.e. a dialog that will block the current page | 22 // Displays a tab-modal dialog, i.e. a dialog that will block the current page |
23 // but still allow the user to switch to a different page. | 23 // but still allow the user to switch to a different page. |
24 // To display the dialog, allocate this object on the heap. It will open the | 24 // To display the dialog, allocate this object on the heap. It will open the |
25 // dialog from its constructor and then delete itself when the user dismisses | 25 // dialog from its constructor and then delete itself when the user dismisses |
26 // the dialog. | 26 // the dialog. |
27 class TabModalConfirmDialogGtk : public TabModalConfirmDialog, | 27 class TabModalConfirmDialogGtk : public TabModalConfirmDialog { |
28 public ConstrainedWindowGtkDelegate { | |
29 public: | 28 public: |
30 TabModalConfirmDialogGtk(TabModalConfirmDialogDelegate* delegate, | 29 TabModalConfirmDialogGtk(TabModalConfirmDialogDelegate* delegate, |
31 content::WebContents* web_contents); | 30 content::WebContents* web_contents); |
32 | 31 |
33 // ConstrainedWindowGtkDelegate: | |
34 virtual GtkWidget* GetWidgetRoot() OVERRIDE; | |
35 virtual GtkWidget* GetFocusWidget() OVERRIDE; | |
36 virtual void DeleteDelegate() OVERRIDE; | |
37 | |
38 private: | 32 private: |
39 friend class TabModalConfirmDialogTest; | 33 friend class TabModalConfirmDialogTest; |
40 | 34 |
41 virtual ~TabModalConfirmDialogGtk(); | 35 virtual ~TabModalConfirmDialogGtk(); |
42 | 36 |
43 // TabModalConfirmDialog: | 37 // TabModalConfirmDialog: |
44 virtual void AcceptTabModalDialog() OVERRIDE; | 38 virtual void AcceptTabModalDialog() OVERRIDE; |
45 virtual void CancelTabModalDialog() OVERRIDE; | 39 virtual void CancelTabModalDialog() OVERRIDE; |
46 | 40 |
47 // TabModalConfirmDialogCloseDelegate: | 41 // TabModalConfirmDialogCloseDelegate: |
48 virtual void CloseDialog() OVERRIDE; | 42 virtual void CloseDialog() OVERRIDE; |
49 | 43 |
50 // Callbacks: | 44 // Callbacks: |
51 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnAccept); | 45 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnAccept); |
52 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnCancel); | 46 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnCancel); |
| 47 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnDestroy); |
53 | 48 |
54 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; | 49 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; |
55 | 50 |
56 GtkWidget* dialog_; | 51 GtkWidget* dialog_; |
57 GtkWidget* ok_; | 52 GtkWidget* ok_; |
58 GtkWidget* cancel_; | 53 GtkWidget* cancel_; |
59 | 54 |
60 GtkWidget* window_; | 55 GtkWidget* window_; |
61 | 56 |
62 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogGtk); | 57 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogGtk); |
63 }; | 58 }; |
64 | 59 |
65 #endif // CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_ | 60 #endif // CHROME_BROWSER_UI_GTK_TAB_MODAL_CONFIRM_DIALOG_GTK_H_ |
OLD | NEW |