OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/repost_form_warning_mac.h" | 5 #include "chrome/browser/ui/cocoa/repost_form_warning_mac.h" |
6 | 6 |
7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
8 #include "chrome/browser/repost_form_warning_controller.h" | 8 #include "chrome/browser/repost_form_warning_controller.h" |
| 9 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
9 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
10 #include "ui/base/l10n/l10n_util_mac.h" | 11 #include "ui/base/l10n/l10n_util_mac.h" |
11 | 12 |
12 // The delegate of the NSAlert used to display the dialog. Forwards the alert's | 13 // The delegate of the NSAlert used to display the dialog. Forwards the alert's |
13 // completion event to the C++ class |RepostFormWarningController|. | 14 // completion event to the C++ class |RepostFormWarningController|. |
14 @interface RepostDelegate : NSObject { | 15 @interface RepostDelegate : NSObject { |
15 RepostFormWarningController* warning_; // weak | 16 RepostFormWarningController* warning_; // weak |
16 } | 17 } |
17 - (id)initWithWarning:(RepostFormWarningController*)warning; | 18 - (id)initWithWarning:(RepostFormWarningController*)warning; |
18 - (void)alertDidEnd:(NSAlert*)alert | 19 - (void)alertDidEnd:(NSAlert*)alert |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING_TITLE)]; | 63 l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING_TITLE)]; |
63 [alert setInformativeText: | 64 [alert setInformativeText: |
64 l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING)]; | 65 l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING)]; |
65 [alert addButtonWithTitle: | 66 [alert addButtonWithTitle: |
66 l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING_RESEND)]; | 67 l10n_util::GetNSStringWithFixup(IDS_HTTP_POST_WARNING_RESEND)]; |
67 [alert addButtonWithTitle: | 68 [alert addButtonWithTitle: |
68 l10n_util::GetNSStringWithFixup(IDS_CANCEL)]; | 69 l10n_util::GetNSStringWithFixup(IDS_CANCEL)]; |
69 | 70 |
70 set_sheet(alert); | 71 set_sheet(alert); |
71 | 72 |
72 controller->set_window(new ConstrainedWindowMac(tab_contents_, this)); | 73 TabContentsWrapper* wrapper = |
| 74 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 75 controller->set_window(new ConstrainedWindowMac(wrapper, this)); |
73 } | 76 } |
74 | 77 |
75 RepostFormWarningMac::~RepostFormWarningMac() { | 78 RepostFormWarningMac::~RepostFormWarningMac() { |
76 NSWindow* window = [(NSAlert*)sheet() window]; | 79 NSWindow* window = [(NSAlert*)sheet() window]; |
77 if (window && is_sheet_open()) { | 80 if (window && is_sheet_open()) { |
78 [NSApp endSheet:window | 81 [NSApp endSheet:window |
79 returnCode:NSAlertSecondButtonReturn]; | 82 returnCode:NSAlertSecondButtonReturn]; |
80 } | 83 } |
81 } | 84 } |
82 | 85 |
83 void RepostFormWarningMac::DeleteDelegate() { | 86 void RepostFormWarningMac::DeleteDelegate() { |
84 delete this; | 87 delete this; |
85 } | 88 } |
OLD | NEW |