| 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 #include "chrome/browser/download/download_permission_request.h" | 5 #include "chrome/browser/download/download_permission_request.h" |
| 6 | 6 |
| 7 #include "chrome/grit/generated_resources.h" | 7 #include "chrome/grit/generated_resources.h" |
| 8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
| 9 #include "grit/theme_resources.h" | 9 #include "grit/theme_resources.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| 11 | 11 |
| 12 DownloadPermissionRequest::DownloadPermissionRequest( | 12 DownloadPermissionRequest::DownloadPermissionRequest( |
| 13 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) | 13 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) |
| 14 : host_(host) { | 14 : host_(host) { |
| 15 const content::WebContents* web_contents = host_->web_contents(); | 15 const content::WebContents* web_contents = host_->web_contents(); |
| 16 DCHECK(web_contents); | 16 DCHECK(web_contents); |
| 17 request_origin_ = web_contents->GetURL().GetOrigin(); | 17 request_origin_ = web_contents->GetURL().GetOrigin(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 DownloadPermissionRequest::~DownloadPermissionRequest() {} | 20 DownloadPermissionRequest::~DownloadPermissionRequest() {} |
| 21 | 21 |
| 22 int DownloadPermissionRequest::GetIconId() const { | 22 int DownloadPermissionRequest::GetIconId() const { |
| 23 return IDR_INFOBAR_MULTIPLE_DOWNLOADS; | 23 return IDR_INFOBAR_MULTIPLE_DOWNLOADS; |
| 24 } | 24 } |
| 25 | 25 |
| 26 base::string16 DownloadPermissionRequest::GetMessageText() const { | |
| 27 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); | |
| 28 } | |
| 29 | |
| 30 base::string16 DownloadPermissionRequest::GetMessageTextFragment() const { | 26 base::string16 DownloadPermissionRequest::GetMessageTextFragment() const { |
| 31 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT); | 27 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT); |
| 32 } | 28 } |
| 33 | 29 |
| 34 GURL DownloadPermissionRequest::GetOrigin() const { | 30 GURL DownloadPermissionRequest::GetOrigin() const { |
| 35 return request_origin_; | 31 return request_origin_; |
| 36 } | 32 } |
| 37 | 33 |
| 38 void DownloadPermissionRequest::PermissionGranted() { | 34 void DownloadPermissionRequest::PermissionGranted() { |
| 39 if (host_) { | 35 if (host_) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 57 } | 53 } |
| 58 | 54 |
| 59 void DownloadPermissionRequest::RequestFinished() { | 55 void DownloadPermissionRequest::RequestFinished() { |
| 60 delete this; | 56 delete this; |
| 61 } | 57 } |
| 62 | 58 |
| 63 PermissionBubbleType DownloadPermissionRequest::GetPermissionBubbleType() | 59 PermissionBubbleType DownloadPermissionRequest::GetPermissionBubbleType() |
| 64 const { | 60 const { |
| 65 return PermissionBubbleType::DOWNLOAD; | 61 return PermissionBubbleType::DOWNLOAD; |
| 66 } | 62 } |
| OLD | NEW |