| 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/infobars/infobar_service.h" | 7 #include "chrome/browser/infobars/infobar_service.h" |
| 8 #include "chrome/grit/generated_resources.h" | 8 #include "chrome/grit/generated_resources.h" |
| 9 #include "components/infobars/core/infobar.h" | 9 #include "components/infobars/core/infobar.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // static | 47 // static |
| 48 void DownloadRequestInfoBarDelegateAndroid::SetCallbackForTesting( | 48 void DownloadRequestInfoBarDelegateAndroid::SetCallbackForTesting( |
| 49 FakeCreateCallback* callback) { | 49 FakeCreateCallback* callback) { |
| 50 DownloadRequestInfoBarDelegateAndroid::callback_ = callback; | 50 DownloadRequestInfoBarDelegateAndroid::callback_ = callback; |
| 51 } | 51 } |
| 52 | 52 |
| 53 DownloadRequestInfoBarDelegateAndroid::DownloadRequestInfoBarDelegateAndroid( | 53 DownloadRequestInfoBarDelegateAndroid::DownloadRequestInfoBarDelegateAndroid( |
| 54 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) | 54 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) |
| 55 : ConfirmInfoBarDelegate(), responded_(false), host_(host) {} | 55 : ConfirmInfoBarDelegate(), responded_(false), host_(host) {} |
| 56 | 56 |
| 57 std::string DownloadRequestInfoBarDelegateAndroid::GetIdentifier() const { |
| 58 return "DownloadRequestInfoBarDelegateAndroid"; |
| 59 } |
| 60 |
| 57 int DownloadRequestInfoBarDelegateAndroid::GetIconId() const { | 61 int DownloadRequestInfoBarDelegateAndroid::GetIconId() const { |
| 58 return IDR_INFOBAR_MULTIPLE_DOWNLOADS; | 62 return IDR_INFOBAR_MULTIPLE_DOWNLOADS; |
| 59 } | 63 } |
| 60 | 64 |
| 61 base::string16 DownloadRequestInfoBarDelegateAndroid::GetMessageText() const { | 65 base::string16 DownloadRequestInfoBarDelegateAndroid::GetMessageText() const { |
| 62 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); | 66 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); |
| 63 } | 67 } |
| 64 | 68 |
| 65 base::string16 DownloadRequestInfoBarDelegateAndroid::GetButtonLabel( | 69 base::string16 DownloadRequestInfoBarDelegateAndroid::GetButtonLabel( |
| 66 InfoBarButton button) const { | 70 InfoBarButton button) const { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 81 | 85 |
| 82 bool DownloadRequestInfoBarDelegateAndroid::Cancel() { | 86 bool DownloadRequestInfoBarDelegateAndroid::Cancel() { |
| 83 DCHECK(!responded_); | 87 DCHECK(!responded_); |
| 84 responded_ = true; | 88 responded_ = true; |
| 85 if (host_) { | 89 if (host_) { |
| 86 // This may invalidate |host_|. | 90 // This may invalidate |host_|. |
| 87 host_->Cancel(); | 91 host_->Cancel(); |
| 88 } | 92 } |
| 89 return !host_; | 93 return !host_; |
| 90 } | 94 } |
| OLD | NEW |