| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_PERMISSION_REQUEST_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PERMISSION_REQUEST_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PERMISSION_REQUEST_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PERMISSION_REQUEST_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/download/download_request_limiter.h" | 10 #include "chrome/browser/download/download_request_limiter.h" |
| 11 #include "chrome/browser/permissions/permission_request.h" | 11 #include "chrome/browser/permissions/permission_request.h" |
| 12 | 12 |
| 13 // A permission request that presents the user with a choice to allow or deny | 13 // A permission request that presents the user with a choice to allow or deny |
| 14 // multiple downloads from the same site. This confirmation step protects | 14 // multiple downloads from the same site. This confirmation step protects |
| 15 // against "carpet-bombing", where a malicious site forces multiple downloads on | 15 // against "carpet-bombing", where a malicious site forces multiple downloads on |
| 16 // an unsuspecting user. | 16 // an unsuspecting user. |
| 17 class DownloadPermissionRequest : public PermissionRequest { | 17 class DownloadPermissionRequest : public PermissionRequest { |
| 18 public: | 18 public: |
| 19 explicit DownloadPermissionRequest( | 19 explicit DownloadPermissionRequest( |
| 20 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host); | 20 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host); |
| 21 ~DownloadPermissionRequest() override; | 21 ~DownloadPermissionRequest() override; |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 // PermissionBubbleDelegate: | 24 // PermissionRequest: |
| 25 IconId GetIconId() const override; | 25 IconId GetIconId() const override; |
| 26 #if defined(OS_ANDROID) |
| 27 base::string16 GetMessageText() const override; |
| 28 #endif |
| 26 base::string16 GetMessageTextFragment() const override; | 29 base::string16 GetMessageTextFragment() const override; |
| 27 GURL GetOrigin() const override; | 30 GURL GetOrigin() const override; |
| 28 void PermissionGranted() override; | 31 void PermissionGranted() override; |
| 29 void PermissionDenied() override; | 32 void PermissionDenied() override; |
| 30 void Cancelled() override; | 33 void Cancelled() override; |
| 31 void RequestFinished() override; | 34 void RequestFinished() override; |
| 32 PermissionRequestType GetPermissionRequestType() const override; | 35 PermissionRequestType GetPermissionRequestType() const override; |
| 33 | 36 |
| 34 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host_; | 37 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host_; |
| 35 GURL request_origin_; | 38 GURL request_origin_; |
| 36 | 39 |
| 37 DISALLOW_COPY_AND_ASSIGN(DownloadPermissionRequest); | 40 DISALLOW_COPY_AND_ASSIGN(DownloadPermissionRequest); |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PERMISSION_REQUEST_H_ | 43 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_PERMISSION_REQUEST_H_ |
| OLD | NEW |