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/content_settings/permission_queue_controller.h" | 5 #include "chrome/browser/content_settings/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.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
10 #include "chrome/browser/content_settings/permission_context_uma_util.h" | 10 #include "chrome/browser/content_settings/permission_context_uma_util.h" |
11 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" | 11 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" |
12 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
13 #include "chrome/browser/media/midi_permission_infobar_delegate.h" | 13 #include "chrome/browser/media/midi_permission_infobar_delegate.h" |
| 14 #include "chrome/browser/notifications/desktop_notification_infobar_delegate.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/services/gcm/push_messaging_infobar_delegate.h" | 16 #include "chrome/browser/services/gcm/push_messaging_infobar_delegate.h" |
16 #include "chrome/browser/tab_contents/tab_util.h" | 17 #include "chrome/browser/tab_contents/tab_util.h" |
17 #include "chrome/common/content_settings.h" | 18 #include "chrome/common/content_settings.h" |
18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
19 #include "components/infobars/core/infobar.h" | 20 #include "components/infobars/core/infobar.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/notification_details.h" | 22 #include "content/public/browser/notification_details.h" |
22 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
23 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 void PermissionQueueController::PendingInfobarRequest::CreateInfoBar( | 107 void PermissionQueueController::PendingInfobarRequest::CreateInfoBar( |
107 PermissionQueueController* controller, | 108 PermissionQueueController* controller, |
108 const std::string& display_languages) { | 109 const std::string& display_languages) { |
109 switch (type_) { | 110 switch (type_) { |
110 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 111 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
111 infobar_ = GeolocationInfoBarDelegate::Create( | 112 infobar_ = GeolocationInfoBarDelegate::Create( |
112 GetInfoBarService(id_), controller, id_, requesting_frame_, | 113 GetInfoBarService(id_), controller, id_, requesting_frame_, |
113 display_languages, accept_button_label_); | 114 display_languages, accept_button_label_); |
114 break; | 115 break; |
| 116 #if defined(ENABLE_NOTIFICATIONS) |
| 117 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 118 infobar_ = DesktopNotificationInfoBarDelegate::Create( |
| 119 GetInfoBarService(id_), controller, id_, requesting_frame_, |
| 120 display_languages); |
| 121 break; |
| 122 #endif // ENABLE_NOTIFICATIONS |
115 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 123 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
116 infobar_ = MidiPermissionInfoBarDelegate::Create( | 124 infobar_ = MidiPermissionInfoBarDelegate::Create( |
117 GetInfoBarService(id_), controller, id_, requesting_frame_, | 125 GetInfoBarService(id_), controller, id_, requesting_frame_, |
118 display_languages, type_); | 126 display_languages, type_); |
119 break; | 127 break; |
120 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: | 128 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
121 infobar_ = gcm::PushMessagingInfoBarDelegate::Create( | 129 infobar_ = gcm::PushMessagingInfoBarDelegate::Create( |
122 GetInfoBarService(id_), controller, id_, requesting_frame_, | 130 GetInfoBarService(id_), controller, id_, requesting_frame_, |
123 display_languages, type_); | 131 display_languages, type_); |
124 break; | 132 break; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 375 |
368 ContentSetting content_setting = | 376 ContentSetting content_setting = |
369 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 377 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
370 profile_->GetHostContentSettingsMap()->SetContentSetting( | 378 profile_->GetHostContentSettingsMap()->SetContentSetting( |
371 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), | 379 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), |
372 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), | 380 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), |
373 type_, | 381 type_, |
374 std::string(), | 382 std::string(), |
375 content_setting); | 383 content_setting); |
376 } | 384 } |
OLD | NEW |