| 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_infobar_delegate.h" | 5 #include "chrome/browser/permissions/permission_infobar_delegate.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" | 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
| 12 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h" | 12 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h" |
| 13 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro
id.h" | 13 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro
id.h" |
| 14 #include "chrome/browser/notifications/notification_permission_infobar_delegate.
h" | 14 #include "chrome/browser/notifications/notification_permission_infobar_delegate.
h" |
| 15 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" | 15 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" |
| 16 #include "chrome/browser/permissions/permission_request.h" | 16 #include "chrome/browser/permissions/permission_request.h" |
| 17 #include "chrome/browser/permissions/permission_uma_util.h" | 17 #include "chrome/browser/permissions/permission_uma_util.h" |
| 18 #include "chrome/browser/sensor/sensor_permission_infobar_delegate_android.h" |
| 18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 19 #include "components/infobars/core/infobar.h" | 20 #include "components/infobars/core/infobar.h" |
| 20 #include "components/url_formatter/elide_url.h" | 21 #include "components/url_formatter/elide_url.h" |
| 21 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 | 24 |
| 24 // static | 25 // static |
| 25 infobars::InfoBar* PermissionInfoBarDelegate::Create( | 26 infobars::InfoBar* PermissionInfoBarDelegate::Create( |
| 26 InfoBarService* infobar_service, | 27 InfoBarService* infobar_service, |
| 27 ContentSettingsType type, | 28 ContentSettingsType type, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 55 requesting_frame, user_gesture, profile, callback)); | 56 requesting_frame, user_gesture, profile, callback)); |
| 56 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 57 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 57 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: | 58 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
| 58 return std::unique_ptr<PermissionInfoBarDelegate>( | 59 return std::unique_ptr<PermissionInfoBarDelegate>( |
| 59 new NotificationPermissionInfoBarDelegate( | 60 new NotificationPermissionInfoBarDelegate( |
| 60 type, requesting_frame, user_gesture, profile, callback)); | 61 type, requesting_frame, user_gesture, profile, callback)); |
| 61 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 62 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 62 return std::unique_ptr<PermissionInfoBarDelegate>( | 63 return std::unique_ptr<PermissionInfoBarDelegate>( |
| 63 new MidiPermissionInfoBarDelegateAndroid( | 64 new MidiPermissionInfoBarDelegateAndroid( |
| 64 requesting_frame, user_gesture, profile, callback)); | 65 requesting_frame, user_gesture, profile, callback)); |
| 66 case CONTENT_SETTINGS_TYPE_SENSORS: |
| 67 return std::unique_ptr<PermissionInfoBarDelegate>( |
| 68 new SensorPermissionInfoBarDelegateAndroid( |
| 69 requesting_frame, user_gesture, profile, callback)); |
| 65 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 70 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 66 return std::unique_ptr<PermissionInfoBarDelegate>( | 71 return std::unique_ptr<PermissionInfoBarDelegate>( |
| 67 new ProtectedMediaIdentifierInfoBarDelegateAndroid( | 72 new ProtectedMediaIdentifierInfoBarDelegateAndroid( |
| 68 requesting_frame, user_gesture, profile, callback)); | 73 requesting_frame, user_gesture, profile, callback)); |
| 69 default: | 74 default: |
| 70 NOTREACHED(); | 75 NOTREACHED(); |
| 71 return nullptr; | 76 return nullptr; |
| 72 } | 77 } |
| 73 } | 78 } |
| 74 | 79 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 PermissionInfoBarDelegate* | 171 PermissionInfoBarDelegate* |
| 167 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { | 172 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { |
| 168 return this; | 173 return this; |
| 169 } | 174 } |
| 170 | 175 |
| 171 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, | 176 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, |
| 172 PermissionAction decision) { | 177 PermissionAction decision) { |
| 173 action_taken_ = true; | 178 action_taken_ = true; |
| 174 callback_.Run(update_content_setting, decision); | 179 callback_.Run(update_content_setting, decision); |
| 175 } | 180 } |
| OLD | NEW |