| 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/download/download_request_infobar_delegate.h" | 5 #include "chrome/browser/download/download_request_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_contents.h" | 7 #include "chrome/browser/tab_contents/tab_contents.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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 SkBitmap* DownloadRequestInfoBarDelegate::GetIcon() const { | 31 SkBitmap* DownloadRequestInfoBarDelegate::GetIcon() const { |
| 32 return ResourceBundle::GetSharedInstance().GetBitmapNamed( | 32 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 33 IDR_INFOBAR_MULTIPLE_DOWNLOADS); | 33 IDR_INFOBAR_MULTIPLE_DOWNLOADS); |
| 34 } | 34 } |
| 35 | 35 |
| 36 string16 DownloadRequestInfoBarDelegate::GetMessageText() const { | 36 string16 DownloadRequestInfoBarDelegate::GetMessageText() const { |
| 37 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); | 37 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); |
| 38 } | 38 } |
| 39 | 39 |
| 40 int DownloadRequestInfoBarDelegate::GetButtons() const { | |
| 41 return BUTTON_OK | BUTTON_CANCEL; | |
| 42 } | |
| 43 | |
| 44 string16 DownloadRequestInfoBarDelegate::GetButtonLabel( | 40 string16 DownloadRequestInfoBarDelegate::GetButtonLabel( |
| 45 InfoBarButton button) const { | 41 InfoBarButton button) const { |
| 46 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 42 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
| 47 IDS_MULTI_DOWNLOAD_WARNING_ALLOW : IDS_MULTI_DOWNLOAD_WARNING_DENY); | 43 IDS_MULTI_DOWNLOAD_WARNING_ALLOW : IDS_MULTI_DOWNLOAD_WARNING_DENY); |
| 48 } | 44 } |
| 49 | 45 |
| 50 bool DownloadRequestInfoBarDelegate::Accept() { | 46 bool DownloadRequestInfoBarDelegate::Accept() { |
| 51 if (host_) { | 47 if (host_) { |
| 52 // Accept() call will nullify host_ if no further prompts are required. | 48 // Accept() call will nullify host_ if no further prompts are required. |
| 53 host_->Accept(); | 49 host_->Accept(); |
| 54 } | 50 } |
| 55 | 51 |
| 56 return !host_; | 52 return !host_; |
| 57 } | 53 } |
| 58 | 54 |
| 59 bool DownloadRequestInfoBarDelegate::Cancel() { | 55 bool DownloadRequestInfoBarDelegate::Cancel() { |
| 60 if (host_) { | 56 if (host_) { |
| 61 host_->Cancel(); | 57 host_->Cancel(); |
| 62 host_ = NULL; | 58 host_ = NULL; |
| 63 } | 59 } |
| 64 return true; | 60 return true; |
| 65 } | 61 } |
| OLD | NEW |