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

Side by Side Diff: chrome/browser/media/media_stream_infobar_delegate_android.cc

Issue 1843063002: Don't show scheme in permission prompts if it is HTTPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/media/media_stream_infobar_delegate_android.h" 5 #include "chrome/browser/media/media_stream_infobar_delegate_android.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 kPermissionActionsMax); 101 kPermissionActionsMax);
102 controller_->Cancelled(); 102 controller_->Cancelled();
103 } 103 }
104 104
105 MediaStreamInfoBarDelegateAndroid* 105 MediaStreamInfoBarDelegateAndroid*
106 MediaStreamInfoBarDelegateAndroid::AsMediaStreamInfoBarDelegateAndroid() { 106 MediaStreamInfoBarDelegateAndroid::AsMediaStreamInfoBarDelegateAndroid() {
107 return this; 107 return this;
108 } 108 }
109 109
110 base::string16 MediaStreamInfoBarDelegateAndroid::GetMessageText() const { 110 base::string16 MediaStreamInfoBarDelegateAndroid::GetMessageText() const {
111 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO; 111 return controller_->GetMessageText();
112 if (!controller_->IsAskingForAudio())
113 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY;
114 else if (!controller_->IsAskingForVideo())
115 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY;
116 return l10n_util::GetStringFUTF16(
117 message_id, base::UTF8ToUTF16(controller_->GetSecurityOriginSpec()));
118 } 112 }
119 113
120 base::string16 MediaStreamInfoBarDelegateAndroid::GetButtonLabel( 114 base::string16 MediaStreamInfoBarDelegateAndroid::GetButtonLabel(
121 InfoBarButton button) const { 115 InfoBarButton button) const {
122 return l10n_util::GetStringUTF16((button == BUTTON_OK) 116 return l10n_util::GetStringUTF16((button == BUTTON_OK)
123 ? IDS_MEDIA_CAPTURE_ALLOW 117 ? IDS_MEDIA_CAPTURE_ALLOW
124 : IDS_MEDIA_CAPTURE_BLOCK); 118 : IDS_MEDIA_CAPTURE_BLOCK);
125 } 119 }
126 120
127 bool MediaStreamInfoBarDelegateAndroid::Accept() { 121 bool MediaStreamInfoBarDelegateAndroid::Accept() {
128 GURL origin(controller_->GetSecurityOriginSpec()); 122 if (content::IsOriginSecure(controller_->GetOrigin())) {
129 if (content::IsOriginSecure(origin)) {
130 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", kAllowHttps, 123 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", kAllowHttps,
131 kPermissionActionsMax); 124 kPermissionActionsMax);
132 } else { 125 } else {
133 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", kAllowHttp, 126 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", kAllowHttp,
134 kPermissionActionsMax); 127 kPermissionActionsMax);
135 } 128 }
136 controller_->PermissionGranted(); 129 controller_->PermissionGranted();
137 return true; 130 return true;
138 } 131 }
139 132
140 bool MediaStreamInfoBarDelegateAndroid::Cancel() { 133 bool MediaStreamInfoBarDelegateAndroid::Cancel() {
141 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", kDeny, 134 UMA_HISTOGRAM_ENUMERATION("Media.DevicePermissionActions", kDeny,
142 kPermissionActionsMax); 135 kPermissionActionsMax);
143 controller_->PermissionDenied(); 136 controller_->PermissionDenied();
144 return true; 137 return true;
145 } 138 }
146 139
147 base::string16 MediaStreamInfoBarDelegateAndroid::GetLinkText() const { 140 base::string16 MediaStreamInfoBarDelegateAndroid::GetLinkText() const {
148 return base::string16(); 141 return base::string16();
149 } 142 }
150 143
151 GURL MediaStreamInfoBarDelegateAndroid::GetLinkURL() const { 144 GURL MediaStreamInfoBarDelegateAndroid::GetLinkURL() const {
152 return GURL(chrome::kMediaAccessLearnMoreUrl); 145 return GURL(chrome::kMediaAccessLearnMoreUrl);
153 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698