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/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 Loading... | |
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 default: | |
124 NOTREACHED(); | |
125 return base::string16(); | |
126 } | |
127 return l10n_util::GetStringFUTF16( | |
Timothy Loh
2017/05/25 03:12:08
Logic from PermissionInfoBarDelegate::GetMessageTe
| |
128 message_id, | |
129 url_formatter::FormatUrlForSecurityDisplay( | |
130 GetOrigin(), url_formatter::SchemeDisplay::OMIT_CRYPTOGRAPHIC)); | |
131 } | |
132 | |
103 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { | 133 base::string16 PermissionRequestImpl::GetMessageTextFragment() const { |
104 int message_id; | 134 int message_id; |
105 switch (content_settings_type_) { | 135 switch (content_settings_type_) { |
106 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 136 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
107 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; | 137 message_id = IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT; |
108 break; | 138 break; |
109 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 139 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
110 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: | 140 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
111 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; | 141 message_id = IDS_NOTIFICATION_PERMISSIONS_FRAGMENT; |
112 break; | 142 break; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 195 |
166 PermissionRequestType PermissionRequestImpl::GetPermissionRequestType() | 196 PermissionRequestType PermissionRequestImpl::GetPermissionRequestType() |
167 const { | 197 const { |
168 return PermissionUtil::GetRequestType(content_settings_type_); | 198 return PermissionUtil::GetRequestType(content_settings_type_); |
169 } | 199 } |
170 | 200 |
171 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() | 201 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() |
172 const { | 202 const { |
173 return PermissionUtil::GetGestureType(has_gesture_); | 203 return PermissionUtil::GetGestureType(has_gesture_); |
174 } | 204 } |
OLD | NEW |