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/app/vector_icons/vector_icons.h" | |
8 #include "chrome/grit/generated_resources.h" | 7 #include "chrome/grit/generated_resources.h" |
9 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
10 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
11 | 10 |
| 11 #if defined(OS_ANDROID) |
| 12 #include "chrome/browser/android/android_theme_resources.h" |
| 13 #else |
| 14 #include "chrome/app/vector_icons/vector_icons.h" |
| 15 #endif |
| 16 |
12 DownloadPermissionRequest::DownloadPermissionRequest( | 17 DownloadPermissionRequest::DownloadPermissionRequest( |
13 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) | 18 base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) |
14 : host_(host) { | 19 : host_(host) { |
15 const content::WebContents* web_contents = host_->web_contents(); | 20 const content::WebContents* web_contents = host_->web_contents(); |
16 DCHECK(web_contents); | 21 DCHECK(web_contents); |
17 request_origin_ = web_contents->GetURL().GetOrigin(); | 22 request_origin_ = web_contents->GetURL().GetOrigin(); |
18 } | 23 } |
19 | 24 |
20 DownloadPermissionRequest::~DownloadPermissionRequest() {} | 25 DownloadPermissionRequest::~DownloadPermissionRequest() {} |
21 | 26 |
22 PermissionRequest::IconId DownloadPermissionRequest::GetIconId() const { | 27 PermissionRequest::IconId DownloadPermissionRequest::GetIconId() const { |
| 28 #if defined(OS_ANDROID) |
| 29 return IDR_ANDROID_INFOBAR_MULTIPLE_DOWNLOADS; |
| 30 #else |
23 return kFileDownloadIcon; | 31 return kFileDownloadIcon; |
| 32 #endif |
24 } | 33 } |
25 | 34 |
| 35 #if defined(OS_ANDROID) |
| 36 base::string16 DownloadPermissionRequest::GetMessageText() const { |
| 37 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); |
| 38 } |
| 39 #endif |
| 40 |
26 base::string16 DownloadPermissionRequest::GetMessageTextFragment() const { | 41 base::string16 DownloadPermissionRequest::GetMessageTextFragment() const { |
27 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT); | 42 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT); |
28 } | 43 } |
29 | 44 |
30 GURL DownloadPermissionRequest::GetOrigin() const { | 45 GURL DownloadPermissionRequest::GetOrigin() const { |
31 return request_origin_; | 46 return request_origin_; |
32 } | 47 } |
33 | 48 |
34 void DownloadPermissionRequest::PermissionGranted() { | 49 void DownloadPermissionRequest::PermissionGranted() { |
35 if (host_) { | 50 if (host_) { |
(...skipping 17 matching lines...) Expand all Loading... |
53 } | 68 } |
54 | 69 |
55 void DownloadPermissionRequest::RequestFinished() { | 70 void DownloadPermissionRequest::RequestFinished() { |
56 delete this; | 71 delete this; |
57 } | 72 } |
58 | 73 |
59 PermissionRequestType DownloadPermissionRequest::GetPermissionRequestType() | 74 PermissionRequestType DownloadPermissionRequest::GetPermissionRequestType() |
60 const { | 75 const { |
61 return PermissionRequestType::DOWNLOAD; | 76 return PermissionRequestType::DOWNLOAD; |
62 } | 77 } |
OLD | NEW |