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 #include "chrome/browser/download/download_permission_request.h"
7 #include "chrome/grit/generated_resources.h"
8 #include "content/public/browser/web_contents.h"
9 #include "grit/theme_resources.h"
10 #include "ui/base/l10n/l10n_util.h"
12 DownloadPermissionRequest::DownloadPermissionRequest(
13 base::WeakPtr
<DownloadRequestLimiter::TabDownloadState
> host
)
15 const content::WebContents
* web_contents
= host_
->web_contents();
17 request_url_
= web_contents
->GetURL();
20 DownloadPermissionRequest::~DownloadPermissionRequest() {}
22 int DownloadPermissionRequest::GetIconId() const {
23 return IDR_INFOBAR_MULTIPLE_DOWNLOADS
;
26 base::string16
DownloadPermissionRequest::GetMessageText() const {
27 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING
);
30 base::string16
DownloadPermissionRequest::GetMessageTextFragment() const {
31 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT
);
34 bool DownloadPermissionRequest::HasUserGesture() const {
35 // TODO(felt): Right now, the user gesture is not being used so this value
36 // does not matter. The user gesture-related code either needs to be
37 // deprecated, or clients (like DownloadPermissionRequest) with their own
38 // user intent policies need to be able to disable/control the bubble request
39 // visibility & coalescing logic. See crbug.com/446607.
43 GURL
DownloadPermissionRequest::GetRequestingHostname() const {
47 void DownloadPermissionRequest::PermissionGranted() {
49 // This may invalidate |host_|.
54 void DownloadPermissionRequest::PermissionDenied() {
56 // This may invalidate |host_|.
61 void DownloadPermissionRequest::Cancelled() {
63 // This may invalidate |host_|.
68 void DownloadPermissionRequest::RequestFinished() {