OLD | NEW |
1 // Copyright (c) 2009 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome/browser/download/download_request_limiter.h" | 10 #include "chrome/browser/download/download_request_limiter.h" |
11 #include "chrome/browser/tab_contents/infobar_delegate.h" | 11 #include "chrome/browser/tab_contents/infobar_delegate.h" |
12 | 12 |
13 class TabContents; | 13 class TabContents; |
14 | 14 |
15 // An infobar delegate that presents the user with a choice to allow or deny | 15 // An infobar delegate that presents the user with a choice to allow or deny |
16 // multiple downloads from the same site. This confirmation step protects | 16 // multiple downloads from the same site. This confirmation step protects |
17 // against "carpet-bombing", where a malicious site forces multiple downloads | 17 // against "carpet-bombing", where a malicious site forces multiple downloads |
18 // on an unsuspecting user. | 18 // on an unsuspecting user. |
19 class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate { | 19 class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate { |
20 public: | 20 public: |
21 DownloadRequestInfoBarDelegate( | 21 DownloadRequestInfoBarDelegate( |
22 TabContents* tab, DownloadRequestLimiter::TabDownloadState* host); | 22 TabContents* tab, |
23 | 23 DownloadRequestLimiter::TabDownloadState* host); |
24 virtual ~DownloadRequestInfoBarDelegate(); | |
25 | 24 |
26 void set_host(DownloadRequestLimiter::TabDownloadState* host) { | 25 void set_host(DownloadRequestLimiter::TabDownloadState* host) { |
27 host_ = host; | 26 host_ = host; |
28 } | 27 } |
29 | 28 |
| 29 private: |
| 30 virtual ~DownloadRequestInfoBarDelegate(); |
| 31 |
| 32 // ConfirmInfoBarDelegate: |
30 virtual void InfoBarClosed(); | 33 virtual void InfoBarClosed(); |
31 | 34 virtual SkBitmap* GetIcon() const; |
32 virtual string16 GetMessageText() const; | 35 virtual string16 GetMessageText() const; |
33 | |
34 virtual SkBitmap* GetIcon() const; | |
35 | |
36 virtual int GetButtons() const; | 36 virtual int GetButtons() const; |
37 | 37 virtual string16 GetButtonLabel(InfoBarButton button) const; |
38 virtual string16 GetButtonLabel( | |
39 ConfirmInfoBarDelegate::InfoBarButton button) const; | |
40 | |
41 virtual bool Accept(); | 38 virtual bool Accept(); |
42 | |
43 virtual bool Cancel(); | 39 virtual bool Cancel(); |
44 | 40 |
45 private: | |
46 DownloadRequestLimiter::TabDownloadState* host_; | 41 DownloadRequestLimiter::TabDownloadState* host_; |
47 | 42 |
48 DISALLOW_COPY_AND_ASSIGN(DownloadRequestInfoBarDelegate); | 43 DISALLOW_COPY_AND_ASSIGN(DownloadRequestInfoBarDelegate); |
49 }; | 44 }; |
50 | 45 |
51 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ | 46 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_ |
OLD | NEW |