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

Side by Side Diff: chrome/browser/permissions/permission_request_impl.cc

Issue 2897223002: Fix message text for modal prompts when PermissionRequestManager enabled (Closed)
Patch Set: add mic/cam in switch Created 3 years, 7 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/permissions/permission_request_impl.h" 5 #include "chrome/browser/permissions/permission_request_impl.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" 8 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
9 #include "chrome/browser/permissions/permission_uma_util.h" 9 #include "chrome/browser/permissions/permission_uma_util.h"
10 #include "chrome/browser/permissions/permission_util.h" 10 #include "chrome/browser/permissions/permission_util.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return ui::kMicrophoneIcon; 93 return ui::kMicrophoneIcon;
94 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: 94 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
95 return ui::kVideocamIcon; 95 return ui::kVideocamIcon;
96 default: 96 default:
97 NOTREACHED(); 97 NOTREACHED();
98 return kExtensionIcon; 98 return kExtensionIcon;
99 } 99 }
100 #endif 100 #endif
101 } 101 }
102 102
103 base::string16 PermissionRequestImpl::GetMessageText() const {
104 #if !defined(OS_ANDROID)
105 // This is currently only used for modal dialogs on Android.
106 NOTREACHED();
107 #endif
108 int message_id;
109 switch (content_settings_type_) {
110 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
111 message_id = IDS_GEOLOCATION_INFOBAR_QUESTION;
112 break;
113 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
114 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
115 message_id = IDS_NOTIFICATION_PERMISSIONS;
116 break;
117 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
118 message_id = IDS_MIDI_SYSEX_INFOBAR_QUESTION;
119 break;
120 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
121 message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION;
122 break;
123 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
124 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY;
125 break;
126 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
127 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY;
128 break;
129 default:
130 NOTREACHED();
131 return base::string16();
132 }
133 return l10n_util::GetStringFUTF16(
134 message_id,
135 url_formatter::FormatUrlForSecurityDisplay(
136 GetOrigin(), url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC));
137 }
138
103 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { 139 base::string16 PermissionRequestImpl::GetMessageTextFragment() const {
104 int message_id; 140 int message_id;
105 switch (content_settings_type_) { 141 switch (content_settings_type_) {
106 case CONTENT_SETTINGS_TYPE_GEOLOCATION: 142 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
107 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; 143 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT;
108 break; 144 break;
109 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 145 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
110 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: 146 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
111 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; 147 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT;
112 break; 148 break;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 201
166 PermissionRequestType PermissionRequestImpl::GetPermissionRequestType() 202 PermissionRequestType PermissionRequestImpl::GetPermissionRequestType()
167 const { 203 const {
168 return PermissionUtil::GetRequestType(content_settings_type_); 204 return PermissionUtil::GetRequestType(content_settings_type_);
169 } 205 }
170 206
171 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() 207 PermissionRequestGestureType PermissionRequestImpl::GetGestureType()
172 const { 208 const {
173 return PermissionUtil::GetGestureType(has_gesture_); 209 return PermissionUtil::GetGestureType(has_gesture_);
174 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698