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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
10 #include "chrome/browser/download/download_request_limiter.h" | 10 #include "chrome/browser/download/download_request_limiter.h" |
11 | 11 |
| 12 class InfoBarTabService; |
| 13 |
12 // An infobar delegate that presents the user with a choice to allow or deny | 14 // An infobar delegate that presents the user with a choice to allow or deny |
13 // multiple downloads from the same site. This confirmation step protects | 15 // multiple downloads from the same site. This confirmation step protects |
14 // against "carpet-bombing", where a malicious site forces multiple downloads | 16 // against "carpet-bombing", where a malicious site forces multiple downloads |
15 // on an unsuspecting user. | 17 // on an unsuspecting user. |
16 class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate { | 18 class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate { |
17 public: | 19 public: |
18 DownloadRequestInfoBarDelegate( | 20 DownloadRequestInfoBarDelegate( |
19 InfoBarTabHelper* infobar_helper, | 21 InfoBarTabService* infobar_service, |
20 DownloadRequestLimiter::TabDownloadState* host); | 22 DownloadRequestLimiter::TabDownloadState* host); |
21 | 23 |
22 void set_host(DownloadRequestLimiter::TabDownloadState* host) { | 24 void set_host(DownloadRequestLimiter::TabDownloadState* host) { |
23 host_ = host; | 25 host_ = host; |
24 } | 26 } |
25 | 27 |
26 private: | 28 private: |
27 virtual ~DownloadRequestInfoBarDelegate(); | 29 virtual ~DownloadRequestInfoBarDelegate(); |
28 | 30 |
29 // ConfirmInfoBarDelegate: | 31 // ConfirmInfoBarDelegate: |
30 virtual gfx::Image* GetIcon() const OVERRIDE; | 32 virtual gfx::Image* GetIcon() const OVERRIDE; |
31 virtual string16 GetMessageText() const OVERRIDE; | 33 virtual string16 GetMessageText() const OVERRIDE; |
32 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 34 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
33 virtual bool Accept() OVERRIDE; | 35 virtual bool Accept() OVERRIDE; |
34 | 36 |
35 DownloadRequestLimiter::TabDownloadState* host_; | 37 DownloadRequestLimiter::TabDownloadState* host_; |
36 | 38 |
37 DISALLOW_COPY_AND_ASSIGN(DownloadRequestInfoBarDelegate); | 39 DISALLOW_COPY_AND_ASSIGN(DownloadRequestInfoBarDelegate); |
38 }; | 40 }; |
39 | 41 |
40 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ | 42 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ |
OLD | NEW |