| 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 TabContents; | |
| 17 class TabModalConfirmDialogDelegate; | 16 class TabModalConfirmDialogDelegate; |
| 18 | 17 |
| 18 namespace content { |
| 19 class WebContents; |
| 20 } |
| 21 |
| 19 // 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 |
| 20 // but still allow the user to switch to a different page. | 23 // but still allow the user to switch to a different page. |
| 21 // 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 |
| 22 // 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 |
| 23 // the dialog. | 26 // the dialog. |
| 24 class TabModalConfirmDialogGtk : public TabModalConfirmDialog, | 27 class TabModalConfirmDialogGtk : public TabModalConfirmDialog, |
| 25 public ConstrainedWindowGtkDelegate { | 28 public ConstrainedWindowGtkDelegate { |
| 26 public: | 29 public: |
| 27 TabModalConfirmDialogGtk(TabModalConfirmDialogDelegate* delegate, | 30 TabModalConfirmDialogGtk(TabModalConfirmDialogDelegate* delegate, |
| 28 TabContents* tab_contents); | 31 content::WebContents* web_contents); |
| 29 | 32 |
| 30 // ConstrainedWindowGtkDelegate: | 33 // ConstrainedWindowGtkDelegate: |
| 31 virtual GtkWidget* GetWidgetRoot() OVERRIDE; | 34 virtual GtkWidget* GetWidgetRoot() OVERRIDE; |
| 32 virtual GtkWidget* GetFocusWidget() OVERRIDE; | 35 virtual GtkWidget* GetFocusWidget() OVERRIDE; |
| 33 virtual void DeleteDelegate() OVERRIDE; | 36 virtual void DeleteDelegate() OVERRIDE; |
| 34 | 37 |
| 35 private: | 38 private: |
| 36 friend class TabModalConfirmDialogTest; | 39 friend class TabModalConfirmDialogTest; |
| 37 | 40 |
| 38 virtual ~TabModalConfirmDialogGtk(); | 41 virtual ~TabModalConfirmDialogGtk(); |
| 39 | 42 |
| 40 // TabModalConfirmDialog: | 43 // TabModalConfirmDialog: |
| 41 virtual void AcceptTabModalDialog() OVERRIDE; | 44 virtual void AcceptTabModalDialog() OVERRIDE; |
| 42 virtual void CancelTabModalDialog() OVERRIDE; | 45 virtual void CancelTabModalDialog() OVERRIDE; |
| 43 | 46 |
| 44 // Callbacks: | 47 // Callbacks: |
| 45 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnAccept); | 48 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnAccept); |
| 46 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnCancel); | 49 CHROMEGTK_CALLBACK_0(TabModalConfirmDialogGtk, void, OnCancel); |
| 47 | 50 |
| 48 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; | 51 scoped_ptr<TabModalConfirmDialogDelegate> delegate_; |
| 49 | 52 |
| 50 GtkWidget* dialog_; | 53 GtkWidget* dialog_; |
| 51 GtkWidget* ok_; | 54 GtkWidget* ok_; |
| 52 GtkWidget* cancel_; | 55 GtkWidget* cancel_; |
| 53 | 56 |
| 54 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogGtk); | 57 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogGtk); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 #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 |