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 #include "chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h" | 5 #include "chrome/browser/ui/cocoa/tab_modal_confirm_dialog_mac.h" |
6 | 6 |
7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "chrome/browser/ui/browser_dialogs.h" | 8 #include "chrome/browser/ui/browser_dialogs.h" |
9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" | 9 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" |
10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 10 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
11 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" | 11 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" |
12 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 12 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "ui/base/l10n/l10n_util_mac.h" | 14 #include "ui/base/l10n/l10n_util_mac.h" |
15 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
16 | 16 |
17 // static | 17 // static |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 action:@selector(onAcceptButton:)]; | 66 action:@selector(onAcceptButton:)]; |
67 [alert_ addButtonWithTitle: | 67 [alert_ addButtonWithTitle: |
68 l10n_util::FixUpWindowsStyleLabel(delegate->GetCancelButtonTitle()) | 68 l10n_util::FixUpWindowsStyleLabel(delegate->GetCancelButtonTitle()) |
69 keyEquivalent:kKeyEquivalentEscape | 69 keyEquivalent:kKeyEquivalentEscape |
70 target:bridge_ | 70 target:bridge_ |
71 action:@selector(onCancelButton:)]; | 71 action:@selector(onCancelButton:)]; |
72 [[alert_ closeButton] setTarget:bridge_]; | 72 [[alert_ closeButton] setTarget:bridge_]; |
73 [[alert_ closeButton] setAction:@selector(onCancelButton:)]; | 73 [[alert_ closeButton] setAction:@selector(onCancelButton:)]; |
74 [alert_ layout]; | 74 [alert_ layout]; |
75 | 75 |
76 scoped_nsobject<CustomConstrainedWindowSheet> sheet( | 76 base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( |
77 [[CustomConstrainedWindowSheet alloc] | 77 [[CustomConstrainedWindowSheet alloc] |
78 initWithCustomWindow:[alert_ window]]); | 78 initWithCustomWindow:[alert_ window]]); |
79 window_.reset(new ConstrainedWindowMac(this, web_contents, sheet)); | 79 window_.reset(new ConstrainedWindowMac(this, web_contents, sheet)); |
80 delegate_->set_close_delegate(this); | 80 delegate_->set_close_delegate(this); |
81 } | 81 } |
82 | 82 |
83 TabModalConfirmDialogMac::~TabModalConfirmDialogMac() { | 83 TabModalConfirmDialogMac::~TabModalConfirmDialogMac() { |
84 } | 84 } |
85 | 85 |
86 void TabModalConfirmDialogMac::AcceptTabModalDialog() { | 86 void TabModalConfirmDialogMac::AcceptTabModalDialog() { |
87 delegate_->Accept(); | 87 delegate_->Accept(); |
88 } | 88 } |
89 | 89 |
90 void TabModalConfirmDialogMac::CancelTabModalDialog() { | 90 void TabModalConfirmDialogMac::CancelTabModalDialog() { |
91 delegate_->Cancel(); | 91 delegate_->Cancel(); |
92 } | 92 } |
93 | 93 |
94 void TabModalConfirmDialogMac::CloseDialog() { | 94 void TabModalConfirmDialogMac::CloseDialog() { |
95 window_->CloseWebContentsModalDialog(); | 95 window_->CloseWebContentsModalDialog(); |
96 } | 96 } |
97 | 97 |
98 void TabModalConfirmDialogMac::OnConstrainedWindowClosed( | 98 void TabModalConfirmDialogMac::OnConstrainedWindowClosed( |
99 ConstrainedWindowMac* window) { | 99 ConstrainedWindowMac* window) { |
100 delete this; | 100 delete this; |
101 } | 101 } |
OLD | NEW |