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/geolocation/geolocation_infobar_delegate.h" | 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate.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.h" |
| 13 #include "chrome/browser/notifications/desktop_notification_infobar_delegate.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/services/gcm/push_messaging_infobar_delegate.h" | 15 #include "chrome/browser/services/gcm/push_messaging_infobar_delegate.h" |
15 #include "chrome/browser/tab_contents/tab_util.h" | 16 #include "chrome/browser/tab_contents/tab_util.h" |
16 #include "chrome/common/content_settings.h" | 17 #include "chrome/common/content_settings.h" |
17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
18 #include "components/infobars/core/infobar.h" | 19 #include "components/infobars/core/infobar.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
21 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
22 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 const std::string& display_languages) { | 108 const std::string& display_languages) { |
108 // TODO(toyoshim): Remove following ContentType dependent code. | 109 // TODO(toyoshim): Remove following ContentType dependent code. |
109 // Also these InfoBarDelegate can share much more code each other. | 110 // Also these InfoBarDelegate can share much more code each other. |
110 // http://crbug.com/266743 | 111 // http://crbug.com/266743 |
111 switch (type_) { | 112 switch (type_) { |
112 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 113 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
113 infobar_ = GeolocationInfoBarDelegate::Create( | 114 infobar_ = GeolocationInfoBarDelegate::Create( |
114 GetInfoBarService(id_), controller, id_, requesting_frame_, | 115 GetInfoBarService(id_), controller, id_, requesting_frame_, |
115 display_languages, accept_button_label_); | 116 display_languages, accept_button_label_); |
116 break; | 117 break; |
| 118 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 119 infobar_ = DesktopNotificationInfoBarDelegate::Create( |
| 120 GetInfoBarService(id_), controller, id_, requesting_frame_, |
| 121 display_languages); |
| 122 break; |
117 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 123 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
118 infobar_ = MidiPermissionInfoBarDelegate::Create( | 124 infobar_ = MidiPermissionInfoBarDelegate::Create( |
119 GetInfoBarService(id_), controller, id_, requesting_frame_, | 125 GetInfoBarService(id_), controller, id_, requesting_frame_, |
120 display_languages); | 126 display_languages); |
121 break; | 127 break; |
122 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: | 128 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
123 infobar_ = gcm::PushMessagingInfoBarDelegate::Create( | 129 infobar_ = gcm::PushMessagingInfoBarDelegate::Create( |
124 GetInfoBarService(id_), controller, id_, requesting_frame_, | 130 GetInfoBarService(id_), controller, id_, requesting_frame_, |
125 display_languages); | 131 display_languages); |
126 break; | 132 break; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 365 |
360 ContentSetting content_setting = | 366 ContentSetting content_setting = |
361 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 367 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
362 profile_->GetHostContentSettingsMap()->SetContentSetting( | 368 profile_->GetHostContentSettingsMap()->SetContentSetting( |
363 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), | 369 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), |
364 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), | 370 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), |
365 type_, | 371 type_, |
366 std::string(), | 372 std::string(), |
367 content_setting); | 373 content_setting); |
368 } | 374 } |
OLD | NEW |