| 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/download/download_request_infobar_delegate.h" | 5 #include "chrome/browser/download/download_request_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/infobars/infobar_service.h" | 7 #include "chrome/browser/infobars/infobar_service.h" |
| 8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.h" |
| 9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 DownloadRequestInfoBarDelegate::callback_ = callback; | 47 DownloadRequestInfoBarDelegate::callback_ = callback; |
| 48 } | 48 } |
| 49 | 49 |
| 50 DownloadRequestInfoBarDelegate::DownloadRequestInfoBarDelegate( | 50 DownloadRequestInfoBarDelegate::DownloadRequestInfoBarDelegate( |
| 51 InfoBarService* infobar_service, | 51 InfoBarService* infobar_service, |
| 52 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) | 52 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) |
| 53 : ConfirmInfoBarDelegate(infobar_service), | 53 : ConfirmInfoBarDelegate(infobar_service), |
| 54 host_(host) { | 54 host_(host) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 gfx::Image* DownloadRequestInfoBarDelegate::GetIcon() const { | 57 int DownloadRequestInfoBarDelegate::GetIconID() const { |
| 58 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 58 return IDR_INFOBAR_MULTIPLE_DOWNLOADS; |
| 59 IDR_INFOBAR_MULTIPLE_DOWNLOADS); | |
| 60 } | 59 } |
| 61 | 60 |
| 62 string16 DownloadRequestInfoBarDelegate::GetMessageText() const { | 61 string16 DownloadRequestInfoBarDelegate::GetMessageText() const { |
| 63 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); | 62 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); |
| 64 } | 63 } |
| 65 | 64 |
| 66 string16 DownloadRequestInfoBarDelegate::GetButtonLabel( | 65 string16 DownloadRequestInfoBarDelegate::GetButtonLabel( |
| 67 InfoBarButton button) const { | 66 InfoBarButton button) const { |
| 68 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 67 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 69 IDS_MULTI_DOWNLOAD_WARNING_ALLOW : IDS_MULTI_DOWNLOAD_WARNING_DENY); | 68 IDS_MULTI_DOWNLOAD_WARNING_ALLOW : IDS_MULTI_DOWNLOAD_WARNING_DENY); |
| 70 } | 69 } |
| 71 | 70 |
| 72 bool DownloadRequestInfoBarDelegate::Accept() { | 71 bool DownloadRequestInfoBarDelegate::Accept() { |
| 73 if (host_) { | 72 if (host_) { |
| 74 // Accept() call will invalidate host_ weak pointer if no further | 73 // Accept() call will invalidate host_ weak pointer if no further |
| 75 // prompts are required. | 74 // prompts are required. |
| 76 host_->Accept(); | 75 host_->Accept(); |
| 77 } | 76 } |
| 78 | 77 |
| 79 return !host_; | 78 return !host_; |
| 80 } | 79 } |
| OLD | NEW |