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; | 12 class InfoBarService; |
13 | 13 |
14 // 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 |
15 // multiple downloads from the same site. This confirmation step protects | 15 // multiple downloads from the same site. This confirmation step protects |
16 // against "carpet-bombing", where a malicious site forces multiple downloads | 16 // against "carpet-bombing", where a malicious site forces multiple downloads |
17 // on an unsuspecting user. | 17 // on an unsuspecting user. |
18 class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate { | 18 class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate { |
19 public: | 19 public: |
20 DownloadRequestInfoBarDelegate( | 20 DownloadRequestInfoBarDelegate( |
21 InfoBarTabService* infobar_service, | 21 InfoBarService* infobar_service, |
22 DownloadRequestLimiter::TabDownloadState* host); | 22 DownloadRequestLimiter::TabDownloadState* host); |
23 | 23 |
24 void set_host(DownloadRequestLimiter::TabDownloadState* host) { | 24 void set_host(DownloadRequestLimiter::TabDownloadState* host) { |
25 host_ = host; | 25 host_ = host; |
26 } | 26 } |
27 | 27 |
28 private: | 28 private: |
29 virtual ~DownloadRequestInfoBarDelegate(); | 29 virtual ~DownloadRequestInfoBarDelegate(); |
30 | 30 |
31 // ConfirmInfoBarDelegate: | 31 // ConfirmInfoBarDelegate: |
32 virtual gfx::Image* GetIcon() const OVERRIDE; | 32 virtual gfx::Image* GetIcon() const OVERRIDE; |
33 virtual string16 GetMessageText() const OVERRIDE; | 33 virtual string16 GetMessageText() const OVERRIDE; |
34 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 34 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
35 virtual bool Accept() OVERRIDE; | 35 virtual bool Accept() OVERRIDE; |
36 | 36 |
37 DownloadRequestLimiter::TabDownloadState* host_; | 37 DownloadRequestLimiter::TabDownloadState* host_; |
38 | 38 |
39 DISALLOW_COPY_AND_ASSIGN(DownloadRequestInfoBarDelegate); | 39 DISALLOW_COPY_AND_ASSIGN(DownloadRequestInfoBarDelegate); |
40 }; | 40 }; |
41 | 41 |
42 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ | 42 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ |
OLD | NEW |