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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
9 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
10 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" | 10 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 [alert addButtonWithTitle: | 75 [alert addButtonWithTitle: |
76 l10n_util::FixUpWindowsStyleLabel(delegate->GetAcceptButtonTitle())]; | 76 l10n_util::FixUpWindowsStyleLabel(delegate->GetAcceptButtonTitle())]; |
77 [alert addButtonWithTitle: | 77 [alert addButtonWithTitle: |
78 l10n_util::FixUpWindowsStyleLabel(delegate->GetCancelButtonTitle())]; | 78 l10n_util::FixUpWindowsStyleLabel(delegate->GetCancelButtonTitle())]; |
79 gfx::Image* icon = delegate->GetIcon(); | 79 gfx::Image* icon = delegate->GetIcon(); |
80 if (icon) | 80 if (icon) |
81 [alert setIcon:icon->ToNSImage()]; | 81 [alert setIcon:icon->ToNSImage()]; |
82 | 82 |
83 set_sheet(alert); | 83 set_sheet(alert); |
84 | 84 |
85 delegate->set_window(new ConstrainedWindowMac(tab_contents, this)); | 85 delegate->set_window( |
| 86 new ConstrainedWindowMac(tab_contents->web_contents(), this)); |
86 } | 87 } |
87 | 88 |
88 TabModalConfirmDialogMac::~TabModalConfirmDialogMac() { | 89 TabModalConfirmDialogMac::~TabModalConfirmDialogMac() { |
89 CancelTabModalDialog(); | 90 CancelTabModalDialog(); |
90 } | 91 } |
91 | 92 |
92 // "DeleteDelegate" refers to this class being a ConstrainedWindow delegate | 93 // "DeleteDelegate" refers to this class being a ConstrainedWindow delegate |
93 // and deleting itself, not to deleting the member variable |delegate_|. | 94 // and deleting itself, not to deleting the member variable |delegate_|. |
94 void TabModalConfirmDialogMac::DeleteDelegate() { | 95 void TabModalConfirmDialogMac::DeleteDelegate() { |
95 delete this; | 96 delete this; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 [alert_ addButtonWithTitle: | 158 [alert_ addButtonWithTitle: |
158 l10n_util::FixUpWindowsStyleLabel(delegate->GetCancelButtonTitle()) | 159 l10n_util::FixUpWindowsStyleLabel(delegate->GetCancelButtonTitle()) |
159 keyEquivalent:kKeyEquivalentEscape | 160 keyEquivalent:kKeyEquivalentEscape |
160 target:bridge_ | 161 target:bridge_ |
161 action:@selector(onCancelButton:)]; | 162 action:@selector(onCancelButton:)]; |
162 [[alert_ closeButton] setTarget:bridge_]; | 163 [[alert_ closeButton] setTarget:bridge_]; |
163 [[alert_ closeButton] setAction:@selector(onCancelButton:)]; | 164 [[alert_ closeButton] setAction:@selector(onCancelButton:)]; |
164 [alert_ layout]; | 165 [alert_ layout]; |
165 | 166 |
166 delegate->set_window( | 167 delegate->set_window( |
167 new ConstrainedWindowMac2(tab_contents, [alert_ window])); | 168 new ConstrainedWindowMac2(tab_contents->web_contents(), [alert_ window])); |
168 } | 169 } |
169 | 170 |
170 TabModalConfirmDialogMac2::~TabModalConfirmDialogMac2() { | 171 TabModalConfirmDialogMac2::~TabModalConfirmDialogMac2() { |
171 } | 172 } |
172 | 173 |
173 void TabModalConfirmDialogMac2::AcceptTabModalDialog() { | 174 void TabModalConfirmDialogMac2::AcceptTabModalDialog() { |
174 } | 175 } |
175 | 176 |
176 void TabModalConfirmDialogMac2::CancelTabModalDialog() { | 177 void TabModalConfirmDialogMac2::CancelTabModalDialog() { |
177 } | 178 } |
OLD | NEW |