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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_
6#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_
7#pragma once
8
9#include "base/basictypes.h"
10#include "chrome/browser/download/download_request_limiter.h"
11#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
12
13class TabContents;
14
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
17// against "carpet-bombing", where a malicious site forces multiple downloads
18// on an unsuspecting user.
19class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate {
20 public:
21  DownloadRequestInfoBarDelegate(
22      TabContents* tab,
23      DownloadRequestLimiter::TabDownloadState* host);
24
25  void set_host(DownloadRequestLimiter::TabDownloadState* host) {
26    host_ = host;
27  }
28
29 private:
30  virtual ~DownloadRequestInfoBarDelegate();
31
32  // ConfirmInfoBarDelegate:
33  virtual void InfoBarClosed();
34  virtual SkBitmap* GetIcon() const;
35  virtual string16 GetMessageText() const;
36  virtual string16 GetButtonLabel(InfoBarButton button) const;
37  virtual bool Accept();
38
39  DownloadRequestLimiter::TabDownloadState* host_;
40
41  DISALLOW_COPY_AND_ASSIGN(DownloadRequestInfoBarDelegate);
42};
43
44#endif  // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_INFOBAR_DELEGATE_H_
45