Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2888)

Unified Diff: chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm

Issue 10972002: chrome: Add TabModalConfirmDialog interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no else after return Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm
diff --git a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm b/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm
index 47664811ee8636d1864ee55de20306426d38a261..82e33ab1811a81ca72061066d4d85da9bc394230 100644
--- a/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm
+++ b/chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.mm
@@ -16,6 +16,19 @@
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/gfx/image/image.h"
+// static
+TabModalConfirmDialog* TabModalConfirmDialog::Create(
+ TabModalConfirmDialogDelegate* delegate,
+ TabContents* tab_contents) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableFramelessConstrainedDialogs)) {
+ // Deletes itself when closed.
+ return new TabModalConfirmDialogMac2(delegate, tab_contents);
+ }
+ // Deletes itself when closed.
+ return new TabModalConfirmDialogMac(delegate, tab_contents);
+}
+
// The delegate of the NSAlert used to display the dialog. Forwards the alert's
// completion event to the C++ class |TabModalConfirmDialogDelegate|.
@interface TabModalConfirmDialogMacBridge : NSObject {
@@ -46,23 +59,6 @@
}
@end
-namespace chrome {
-
-// Declared in browser_dialogs.h so others don't have to depend on our header.
-void ShowTabModalConfirmDialog(TabModalConfirmDialogDelegate* delegate,
- TabContents* tab_contents) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableFramelessConstrainedDialogs)) {
- // Deletes itself when closed.
- new TabModalConfirmDialogMac2(delegate, tab_contents);
- } else {
- // Deletes itself when closed.
- new TabModalConfirmDialogMac(delegate, tab_contents);
- }
-}
-
-} // namespace chrome
-
TabModalConfirmDialogMac::TabModalConfirmDialogMac(
TabModalConfirmDialogDelegate* delegate,
TabContents* tab_contents)
@@ -90,11 +86,7 @@ TabModalConfirmDialogMac::TabModalConfirmDialogMac(
}
TabModalConfirmDialogMac::~TabModalConfirmDialogMac() {
- NSWindow* window = [(NSAlert*)sheet() window];
- if (window && is_sheet_open()) {
- [NSApp endSheet:window
- returnCode:NSAlertSecondButtonReturn];
- }
+ CancelTabModalDialog();
}
// "DeleteDelegate" refers to this class being a ConstrainedWindow delegate
@@ -103,6 +95,23 @@ void TabModalConfirmDialogMac::DeleteDelegate() {
delete this;
}
+void TabModalConfirmDialogMac::AcceptTabModalDialog() {
+ NSWindow* window = [(NSAlert*)sheet() window];
+ if (window && is_sheet_open()) {
+ [NSApp endSheet:window
+ returnCode:NSAlertFirstButtonReturn];
+ }
+}
+
+void TabModalConfirmDialogMac::CancelTabModalDialog() {
+ NSWindow* window = [(NSAlert*)sheet() window];
+ if (window && is_sheet_open()) {
+ [NSApp endSheet:window
+ returnCode:NSAlertSecondButtonReturn];
+ }
+}
+
+
@interface TabModalConfirmDialogMacBridge2 : NSObject {
TabModalConfirmDialogDelegate* delegate_; // weak
}
@@ -160,3 +169,9 @@ TabModalConfirmDialogMac2::TabModalConfirmDialogMac2(
TabModalConfirmDialogMac2::~TabModalConfirmDialogMac2() {
}
+
+void TabModalConfirmDialogMac2::AcceptTabModalDialog() {
+}
+
+void TabModalConfirmDialogMac2::CancelTabModalDialog() {
+}
« no previous file with comments | « chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h ('k') | chrome/browser/ui/gtk/tab_modal_confirm_dialog_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698