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 infobars::InfoBarDelegate::InfoBarIdentifier |
| 58 DownloadRequestInfoBarDelegateAndroid::GetIdentifier() const { |
| 59 return DOWNLOAD_REQUEST_INFOBAR_DELEGATE_ANDROID; |
| 60 } |
| 61 |
57 int DownloadRequestInfoBarDelegateAndroid::GetIconId() const { | 62 int DownloadRequestInfoBarDelegateAndroid::GetIconId() const { |
58 return IDR_INFOBAR_MULTIPLE_DOWNLOADS; | 63 return IDR_INFOBAR_MULTIPLE_DOWNLOADS; |
59 } | 64 } |
60 | 65 |
61 base::string16 DownloadRequestInfoBarDelegateAndroid::GetMessageText() const { | 66 base::string16 DownloadRequestInfoBarDelegateAndroid::GetMessageText() const { |
62 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); | 67 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); |
63 } | 68 } |
64 | 69 |
65 base::string16 DownloadRequestInfoBarDelegateAndroid::GetButtonLabel( | 70 base::string16 DownloadRequestInfoBarDelegateAndroid::GetButtonLabel( |
66 InfoBarButton button) const { | 71 InfoBarButton button) const { |
(...skipping 14 matching lines...) Expand all Loading... |
81 | 86 |
82 bool DownloadRequestInfoBarDelegateAndroid::Cancel() { | 87 bool DownloadRequestInfoBarDelegateAndroid::Cancel() { |
83 DCHECK(!responded_); | 88 DCHECK(!responded_); |
84 responded_ = true; | 89 responded_ = true; |
85 if (host_) { | 90 if (host_) { |
86 // This may invalidate |host_|. | 91 // This may invalidate |host_|. |
87 host_->Cancel(); | 92 host_->Cancel(); |
88 } | 93 } |
89 return !host_; | 94 return !host_; |
90 } | 95 } |
OLD | NEW |