1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PERMISSION_REQUEST_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PERMISSION_REQUEST_H_
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/download/download_request_limiter.h"
11 #include "chrome/browser/ui/website_settings/permission_bubble_request.h"
13 // A permission bubble request that presents the user with a choice to allow
14 // or deny multiple downloads from the same site. This confirmation step
15 // protects against "carpet-bombing", where a malicious site forces multiple
16 // downloads on an unsuspecting user.
17 class DownloadPermissionRequest
: public PermissionBubbleRequest
{
19 explicit DownloadPermissionRequest(
20 base::WeakPtr
<DownloadRequestLimiter::TabDownloadState
> host
);
21 ~DownloadPermissionRequest() override
;
23 // PermisisonBubbleDelegate:
24 int GetIconID() const override
;
25 base::string16
GetMessageText() const override
;
26 base::string16
GetMessageTextFragment() const override
;
27 bool HasUserGesture() const override
;
28 GURL
GetRequestingHostname() const override
;
29 void PermissionGranted() override
;
30 void PermissionDenied() override
;
31 void Cancelled() override
;
32 void RequestFinished() override
;
35 base::WeakPtr
<DownloadRequestLimiter::TabDownloadState
> host_
;
37 DISALLOW_COPY_AND_ASSIGN(DownloadPermissionRequest
);
40 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PERMISSION_REQUEST_H_