| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_queue_controller.h" | 5 #include "chrome/browser/permissions/permission_queue_controller.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate.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.h" | 12 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h" |
| 13 #include "chrome/browser/media/protected_media_identifier_infobar_delegate.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_context_uma_util.h" | 15 #include "chrome/browser/permissions/permission_context_uma_util.h" |
| 16 #include "chrome/browser/permissions/permission_request_id.h" | 16 #include "chrome/browser/permissions/permission_request_id.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/storage/durable_storage_permission_infobar_delegate.h" | 18 #include "chrome/browser/storage/durable_storage_permission_infobar_delegate_and
roid.h" |
| 19 #include "chrome/browser/tab_contents/tab_util.h" | 19 #include "chrome/browser/tab_contents/tab_util.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "components/content_settings/core/browser/host_content_settings_map.h" | 21 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 22 #include "components/content_settings/core/common/content_settings.h" | 22 #include "components/content_settings/core/common/content_settings.h" |
| 23 #include "components/infobars/core/infobar.h" | 23 #include "components/infobars/core/infobar.h" |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/browser/notification_details.h" | 25 #include "content/public/browser/notification_details.h" |
| 26 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
| 27 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // is destroyed, all requests will be cancelled and so all delegates | 117 // is destroyed, all requests will be cancelled and so all delegates |
| 118 // will be destroyed. | 118 // will be destroyed. |
| 119 PermissionInfobarDelegate::PermissionSetCallback callback = | 119 PermissionInfobarDelegate::PermissionSetCallback callback = |
| 120 base::Bind(&PermissionQueueController::OnPermissionSet, | 120 base::Bind(&PermissionQueueController::OnPermissionSet, |
| 121 base::Unretained(controller), | 121 base::Unretained(controller), |
| 122 id_, | 122 id_, |
| 123 requesting_frame_, | 123 requesting_frame_, |
| 124 embedder_); | 124 embedder_); |
| 125 switch (type_) { | 125 switch (type_) { |
| 126 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 126 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 127 infobar_ = GeolocationInfoBarDelegate::Create( | 127 infobar_ = GeolocationInfoBarDelegateAndroidAndroid::Create( |
| 128 GetInfoBarService(id_), requesting_frame_, | 128 GetInfoBarService(id_), requesting_frame_, display_languages, |
| 129 display_languages, callback); | 129 callback); |
| 130 break; | 130 break; |
| 131 #if defined(ENABLE_NOTIFICATIONS) | 131 #if defined(ENABLE_NOTIFICATIONS) |
| 132 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 132 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 133 infobar_ = NotificationPermissionInfobarDelegate::Create( | 133 infobar_ = NotificationPermissionInfobarDelegate::Create( |
| 134 GetInfoBarService(id_), requesting_frame_, | 134 GetInfoBarService(id_), requesting_frame_, |
| 135 display_languages, callback); | 135 display_languages, callback); |
| 136 break; | 136 break; |
| 137 #endif // ENABLE_NOTIFICATIONS | 137 #endif // ENABLE_NOTIFICATIONS |
| 138 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 138 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 139 infobar_ = MidiPermissionInfoBarDelegate::Create( | 139 infobar_ = MidiPermissionInfoBarDelegateAndroid::Create( |
| 140 GetInfoBarService(id_), requesting_frame_, | 140 GetInfoBarService(id_), requesting_frame_, display_languages, type_, |
| 141 display_languages, type_, callback); | 141 callback); |
| 142 break; | 142 break; |
| 143 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 143 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 144 infobar_ = ProtectedMediaIdentifierInfoBarDelegate::Create( | 144 infobar_ = ProtectedMediaIdentifierInfoBarDelegateAndroid::Create( |
| 145 GetInfoBarService(id_), requesting_frame_, | 145 GetInfoBarService(id_), requesting_frame_, display_languages, |
| 146 display_languages, callback); | 146 callback); |
| 147 break; | 147 break; |
| 148 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: | 148 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: |
| 149 infobar_ = DurableStoragePermissionInfoBarDelegate::Create( | 149 infobar_ = DurableStoragePermissionInfoBarDelegateAndroid::Create( |
| 150 GetInfoBarService(id_), requesting_frame_, | 150 GetInfoBarService(id_), requesting_frame_, display_languages, type_, |
| 151 display_languages, type_, callback); | 151 callback); |
| 152 break; | 152 break; |
| 153 default: | 153 default: |
| 154 NOTREACHED(); | 154 NOTREACHED(); |
| 155 break; | 155 break; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 | 159 |
| 160 PermissionQueueController::PermissionQueueController(Profile* profile, | 160 PermissionQueueController::PermissionQueueController(Profile* profile, |
| 161 ContentSettingsType type) | 161 ContentSettingsType type) |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 ContentSettingsPattern::Wildcard() : | 404 ContentSettingsPattern::Wildcard() : |
| 405 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()); | 405 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()); |
| 406 | 406 |
| 407 HostContentSettingsMapFactory::GetForProfile(profile_)->SetContentSetting( | 407 HostContentSettingsMapFactory::GetForProfile(profile_)->SetContentSetting( |
| 408 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), | 408 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), |
| 409 embedder_pattern, | 409 embedder_pattern, |
| 410 type_, | 410 type_, |
| 411 std::string(), | 411 std::string(), |
| 412 content_setting); | 412 content_setting); |
| 413 } | 413 } |
| OLD | NEW |