Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: chrome/browser/download/download_permission_request.cc

Issue 1637913002: Change PermissionBubbleRequest::GetRequestingHostname to GetOrigin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_url_ = web_contents->GetURL(); 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 { 26 base::string16 DownloadPermissionRequest::GetMessageText() const {
27 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING); 27 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING);
28 } 28 }
29 29
30 base::string16 DownloadPermissionRequest::GetMessageTextFragment() const { 30 base::string16 DownloadPermissionRequest::GetMessageTextFragment() const {
31 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT); 31 return l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_PERMISSION_FRAGMENT);
32 } 32 }
33 33
34 bool DownloadPermissionRequest::HasUserGesture() const { 34 bool DownloadPermissionRequest::HasUserGesture() const {
35 // TODO(felt): Right now, the user gesture is not being used so this value 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 36 // does not matter. The user gesture-related code either needs to be
37 // deprecated, or clients (like DownloadPermissionRequest) with their own 37 // deprecated, or clients (like DownloadPermissionRequest) with their own
38 // user intent policies need to be able to disable/control the bubble request 38 // user intent policies need to be able to disable/control the bubble request
39 // visibility & coalescing logic. See crbug.com/446607. 39 // visibility & coalescing logic. See crbug.com/446607.
40 return false; 40 return false;
41 } 41 }
42 42
43 GURL DownloadPermissionRequest::GetRequestingHostname() const { 43 GURL DownloadPermissionRequest::GetOrigin() const {
44 return request_url_; 44 return request_origin_;
45 } 45 }
46 46
47 void DownloadPermissionRequest::PermissionGranted() { 47 void DownloadPermissionRequest::PermissionGranted() {
48 if (host_) { 48 if (host_) {
49 // This may invalidate |host_|. 49 // This may invalidate |host_|.
50 host_->Accept(); 50 host_->Accept();
51 } 51 }
52 } 52 }
53 53
54 void DownloadPermissionRequest::PermissionDenied() { 54 void DownloadPermissionRequest::PermissionDenied() {
55 if (host_) { 55 if (host_) {
56 // This may invalidate |host_|. 56 // This may invalidate |host_|.
57 host_->Cancel(); 57 host_->Cancel();
58 } 58 }
59 } 59 }
60 60
61 void DownloadPermissionRequest::Cancelled() { 61 void DownloadPermissionRequest::Cancelled() {
62 if (host_) { 62 if (host_) {
63 // This may invalidate |host_|. 63 // This may invalidate |host_|.
64 host_->CancelOnce(); 64 host_->CancelOnce();
65 } 65 }
66 } 66 }
67 67
68 void DownloadPermissionRequest::RequestFinished() { 68 void DownloadPermissionRequest::RequestFinished() {
69 delete this; 69 delete this;
70 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_permission_request.h ('k') | chrome/browser/media/media_stream_devices_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698