| 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_request.h" | 15 #include "chrome/browser/permissions/permission_request.h" |
| 16 #include "chrome/browser/permissions/permission_uma_util.h" | 16 #include "chrome/browser/permissions/permission_uma_util.h" |
| 17 #include "chrome/browser/sensor/sensor_permission_infobar_delegate_android.h" |
| 17 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 18 #include "components/infobars/core/infobar.h" | 19 #include "components/infobars/core/infobar.h" |
| 19 #include "components/url_formatter/elide_url.h" | 20 #include "components/url_formatter/elide_url.h" |
| 20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 | 23 |
| 23 // static | 24 // static |
| 24 infobars::InfoBar* PermissionInfoBarDelegate::Create( | 25 infobars::InfoBar* PermissionInfoBarDelegate::Create( |
| 25 InfoBarService* infobar_service, | 26 InfoBarService* infobar_service, |
| 26 content::PermissionType type, | 27 content::PermissionType type, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 56 case content::PermissionType::NOTIFICATIONS: | 57 case content::PermissionType::NOTIFICATIONS: |
| 57 case content::PermissionType::PUSH_MESSAGING: | 58 case content::PermissionType::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 #endif // ENABLE_NOTIFICATIONS | 62 #endif // ENABLE_NOTIFICATIONS |
| 62 case content::PermissionType::MIDI_SYSEX: | 63 case content::PermissionType::MIDI_SYSEX: |
| 63 return std::unique_ptr<PermissionInfoBarDelegate>( | 64 return std::unique_ptr<PermissionInfoBarDelegate>( |
| 64 new MidiPermissionInfoBarDelegateAndroid( | 65 new MidiPermissionInfoBarDelegateAndroid( |
| 65 requesting_frame, user_gesture, profile, callback)); | 66 requesting_frame, user_gesture, profile, callback)); |
| 67 case content::PermissionType::SENSORS: |
| 68 return std::unique_ptr<PermissionInfoBarDelegate>( |
| 69 new SensorPermissionInfoBarDelegateAndroid( |
| 70 requesting_frame, user_gesture, profile, callback)); |
| 66 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 71 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 67 return std::unique_ptr<PermissionInfoBarDelegate>( | 72 return std::unique_ptr<PermissionInfoBarDelegate>( |
| 68 new ProtectedMediaIdentifierInfoBarDelegateAndroid( | 73 new ProtectedMediaIdentifierInfoBarDelegateAndroid( |
| 69 requesting_frame, user_gesture, profile, callback)); | 74 requesting_frame, user_gesture, profile, callback)); |
| 70 default: | 75 default: |
| 71 NOTREACHED(); | 76 NOTREACHED(); |
| 72 return nullptr; | 77 return nullptr; |
| 73 } | 78 } |
| 74 } | 79 } |
| 75 | 80 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 PermissionInfoBarDelegate* | 165 PermissionInfoBarDelegate* |
| 161 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { | 166 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { |
| 162 return this; | 167 return this; |
| 163 } | 168 } |
| 164 | 169 |
| 165 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, | 170 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, |
| 166 PermissionAction decision) { | 171 PermissionAction decision) { |
| 167 action_taken_ = true; | 172 action_taken_ = true; |
| 168 callback_.Run(update_content_setting, decision); | 173 callback_.Run(update_content_setting, decision); |
| 169 } | 174 } |
| OLD | NEW |