| 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_android.h" | 5 #include "chrome/browser/download/download_request_infobar_delegate_android.h" |
| 6 | 6 |
| 7 #include "chrome/browser/android/android_theme_resources.h" |
| 7 #include "chrome/browser/infobars/infobar_service.h" | 8 #include "chrome/browser/infobars/infobar_service.h" |
| 8 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 9 #include "chrome/grit/theme_resources.h" | 10 #include "chrome/grit/theme_resources.h" |
| 10 #include "components/infobars/core/infobar.h" | 11 #include "components/infobars/core/infobar.h" |
| 11 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 12 | 13 |
| 13 DownloadRequestInfoBarDelegateAndroid::FakeCreateCallback* | 14 DownloadRequestInfoBarDelegateAndroid::FakeCreateCallback* |
| 14 DownloadRequestInfoBarDelegateAndroid::callback_ = NULL; | 15 DownloadRequestInfoBarDelegateAndroid::callback_ = NULL; |
| 15 | 16 |
| 16 DownloadRequestInfoBarDelegateAndroid:: | 17 DownloadRequestInfoBarDelegateAndroid:: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 DownloadRequestInfoBarDelegateAndroid::DownloadRequestInfoBarDelegateAndroid( | 54 DownloadRequestInfoBarDelegateAndroid::DownloadRequestInfoBarDelegateAndroid( |
| 54 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) | 55 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) |
| 55 : ConfirmInfoBarDelegate(), responded_(false), host_(host) {} | 56 : ConfirmInfoBarDelegate(), responded_(false), host_(host) {} |
| 56 | 57 |
| 57 infobars::InfoBarDelegate::InfoBarIdentifier | 58 infobars::InfoBarDelegate::InfoBarIdentifier |
| 58 DownloadRequestInfoBarDelegateAndroid::GetIdentifier() const { | 59 DownloadRequestInfoBarDelegateAndroid::GetIdentifier() const { |
| 59 return DOWNLOAD_REQUEST_INFOBAR_DELEGATE_ANDROID; | 60 return DOWNLOAD_REQUEST_INFOBAR_DELEGATE_ANDROID; |
| 60 } | 61 } |
| 61 | 62 |
| 62 int DownloadRequestInfoBarDelegateAndroid::GetIconId() const { | 63 int DownloadRequestInfoBarDelegateAndroid::GetIconId() const { |
| 63 return IDR_INFOBAR_MULTIPLE_DOWNLOADS; | 64 return IDR_ANDROID_INFOBAR_MULTIPLE_DOWNLOADS; |
| 64 } | 65 } |
| 65 | 66 |
| 66 base::string16 DownloadRequestInfoBarDelegateAndroid::GetMessageText() const { | 67 base::string16 DownloadRequestInfoBarDelegateAndroid::GetMessageText() const { |
| 67 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); | 68 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); |
| 68 } | 69 } |
| 69 | 70 |
| 70 base::string16 DownloadRequestInfoBarDelegateAndroid::GetButtonLabel( | 71 base::string16 DownloadRequestInfoBarDelegateAndroid::GetButtonLabel( |
| 71 InfoBarButton button) const { | 72 InfoBarButton button) const { |
| 72 return l10n_util::GetStringUTF16((button == BUTTON_OK) | 73 return l10n_util::GetStringUTF16((button == BUTTON_OK) |
| 73 ? IDS_MULTI_DOWNLOAD_WARNING_ALLOW | 74 ? IDS_MULTI_DOWNLOAD_WARNING_ALLOW |
| (...skipping 12 matching lines...) Expand all Loading... |
| 86 | 87 |
| 87 bool DownloadRequestInfoBarDelegateAndroid::Cancel() { | 88 bool DownloadRequestInfoBarDelegateAndroid::Cancel() { |
| 88 DCHECK(!responded_); | 89 DCHECK(!responded_); |
| 89 responded_ = true; | 90 responded_ = true; |
| 90 if (host_) { | 91 if (host_) { |
| 91 // This may invalidate |host_|. | 92 // This may invalidate |host_|. |
| 92 host_->Cancel(); | 93 host_->Cancel(); |
| 93 } | 94 } |
| 94 return !host_; | 95 return !host_; |
| 95 } | 96 } |
| OLD | NEW |