OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/download/download_request_dialog_delegate_win.h" | |
6 | |
7 #include "app/l10n_util.h" | |
8 #include "app/message_box_flags.h" | |
9 #include "chrome/browser/tab_contents/constrained_window.h" | |
10 #include "chrome/browser/tab_contents/tab_contents.h" | |
11 #include "grit/generated_resources.h" | |
12 #include "views/controls/message_box_view.h" | |
13 | |
14 // static | |
15 DownloadRequestDialogDelegate* DownloadRequestDialogDelegate::Create( | |
16 TabContents* tab, | |
17 DownloadRequestManager::TabDownloadState* host) { | |
18 return new DownloadRequestDialogDelegateWin(tab, host); | |
19 } | |
20 | |
21 DownloadRequestDialogDelegateWin::DownloadRequestDialogDelegateWin( | |
22 TabContents* tab, | |
23 DownloadRequestManager::TabDownloadState* host) | |
24 : DownloadRequestDialogDelegate(host) { | |
25 message_view_ = new MessageBoxView( | |
26 MessageBoxFlags::kIsConfirmMessageBox, | |
27 l10n_util::GetString(IDS_MULTI_DOWNLOAD_WARNING), | |
28 std::wstring()); | |
29 window_ = tab->CreateConstrainedDialog(this); | |
30 } | |
31 | |
32 void DownloadRequestDialogDelegateWin::CloseWindow() { | |
33 window_->CloseConstrainedWindow(); | |
34 } | |
35 | |
36 bool DownloadRequestDialogDelegateWin::Cancel() { | |
37 return DoCancel(); | |
38 } | |
39 | |
40 bool DownloadRequestDialogDelegateWin::Accept() { | |
41 return DoAccept(); | |
42 } | |
43 | |
44 views::View* DownloadRequestDialogDelegateWin::GetContentsView() { | |
45 return message_view_; | |
46 } | |
47 | |
48 std::wstring DownloadRequestDialogDelegateWin::GetDialogButtonLabel( | |
49 MessageBoxFlags::DialogButton button) const { | |
50 if (button == MessageBoxFlags::DIALOGBUTTON_OK) | |
51 return l10n_util::GetString(IDS_MULTI_DOWNLOAD_WARNING_ALLOW); | |
52 if (button == MessageBoxFlags::DIALOGBUTTON_CANCEL) | |
53 return l10n_util::GetString(IDS_MULTI_DOWNLOAD_WARNING_DENY); | |
54 return std::wstring(); | |
55 } | |
56 | |
57 void DownloadRequestDialogDelegateWin::DeleteDelegate() { | |
58 DCHECK(!host_); | |
59 delete this; | |
60 } | |
OLD | NEW |