| 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 "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
| 8 #include "grit/generated_resources.h" | 8 #include "grit/generated_resources.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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 base::string16 DownloadPermissionRequest::GetMessageText() const { | 22 base::string16 DownloadPermissionRequest::GetMessageText() const { |
| 23 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); | 23 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); |
| 24 } | 24 } |
| 25 | 25 |
| 26 base::string16 DownloadPermissionRequest::GetMessageTextFragment() const { | 26 base::string16 DownloadPermissionRequest::GetMessageTextFragment() const { |
| 27 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT); | 27 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT); |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool DownloadPermissionRequest::HasUserGesture() const { | 30 bool DownloadPermissionRequest::HasUserGesture() const { |
| 31 // TODO(gbillock): user gesture for multiple downloads is difficult to | 31 // TODO(gbillock): user gesture for multiple downloads is difficult to |
| 32 // propagate, and the normal thing is that it is background. | 32 // propagate, and the normal thing is that it is background. So lie to |
| 33 return false; | 33 // the manager and say it is user gestured. This needs to be examined |
| 34 // for policy coherence... |
| 35 return true; |
| 34 } | 36 } |
| 35 | 37 |
| 36 GURL DownloadPermissionRequest::GetRequestingHostname() const { | 38 GURL DownloadPermissionRequest::GetRequestingHostname() const { |
| 37 const content::WebContents* web_contents = host_->web_contents(); | 39 const content::WebContents* web_contents = host_->web_contents(); |
| 38 if (web_contents) { | 40 if (web_contents) { |
| 39 return web_contents->GetURL(); | 41 return web_contents->GetURL(); |
| 40 } | 42 } |
| 41 return GURL(); | 43 return GURL(); |
| 42 } | 44 } |
| 43 | 45 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 } | 58 } |
| 57 | 59 |
| 58 void DownloadPermissionRequest::Cancelled() { | 60 void DownloadPermissionRequest::Cancelled() { |
| 59 // TODO(gbillock): There's currently no suitable method for telling the host | 61 // TODO(gbillock): There's currently no suitable method for telling the host |
| 60 // that a request is cancelled. | 62 // that a request is cancelled. |
| 61 } | 63 } |
| 62 | 64 |
| 63 void DownloadPermissionRequest::RequestFinished() { | 65 void DownloadPermissionRequest::RequestFinished() { |
| 64 delete this; | 66 delete this; |
| 65 } | 67 } |
| OLD | NEW |