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/permission_context_uma_util.h" | 9 #include "chrome/browser/content_settings/permission_context_uma_util.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/notifications/desktop_notification_infobar_delegate.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/tab_contents/tab_util.h" | 15 #include "chrome/browser/tab_contents/tab_util.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "components/content_settings/core/browser/host_content_settings_map.h" | 17 #include "components/content_settings/core/browser/host_content_settings_map.h" |
18 #include "components/content_settings/core/common/content_settings.h" | 18 #include "components/content_settings/core/common/content_settings.h" |
19 #include "components/infobars/core/infobar.h" | 19 #include "components/infobars/core/infobar.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/notification_details.h" | 21 #include "content/public/browser/notification_details.h" |
22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
23 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
25 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
26 | 26 |
27 #if defined(OS_ANDROID) | 27 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
28 #include "chrome/browser/media/protected_media_identifier_infobar_delegate.h" | 28 #include "chrome/browser/media/protected_media_identifier_infobar_delegate.h" |
29 #endif | 29 #endif |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
33 InfoBarService* GetInfoBarService(const PermissionRequestID& id) { | 33 InfoBarService* GetInfoBarService(const PermissionRequestID& id) { |
34 content::WebContents* web_contents = | 34 content::WebContents* web_contents = |
35 tab_util::GetWebContentsByID(id.render_process_id(), id.render_view_id()); | 35 tab_util::GetWebContentsByID(id.render_process_id(), id.render_view_id()); |
36 return web_contents ? InfoBarService::FromWebContents(web_contents) : NULL; | 36 return web_contents ? InfoBarService::FromWebContents(web_contents) : NULL; |
37 } | 37 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 infobar_ = DesktopNotificationInfoBarDelegate::Create( | 113 infobar_ = DesktopNotificationInfoBarDelegate::Create( |
114 GetInfoBarService(id_), controller, id_, requesting_frame_, | 114 GetInfoBarService(id_), controller, id_, requesting_frame_, |
115 display_languages); | 115 display_languages); |
116 break; | 116 break; |
117 #endif // ENABLE_NOTIFICATIONS | 117 #endif // ENABLE_NOTIFICATIONS |
118 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 118 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
119 infobar_ = MidiPermissionInfoBarDelegate::Create( | 119 infobar_ = MidiPermissionInfoBarDelegate::Create( |
120 GetInfoBarService(id_), controller, id_, requesting_frame_, | 120 GetInfoBarService(id_), controller, id_, requesting_frame_, |
121 display_languages, type_); | 121 display_languages, type_); |
122 break; | 122 break; |
123 #if defined(OS_ANDROID) | 123 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
124 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 124 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
125 infobar_ = ProtectedMediaIdentifierInfoBarDelegate::Create( | 125 infobar_ = ProtectedMediaIdentifierInfoBarDelegate::Create( |
126 GetInfoBarService(id_), controller, id_, requesting_frame_, | 126 GetInfoBarService(id_), controller, id_, requesting_frame_, |
127 display_languages); | 127 display_languages); |
128 break; | 128 break; |
129 #endif | 129 #endif |
130 default: | 130 default: |
131 NOTREACHED(); | 131 NOTREACHED(); |
132 break; | 132 break; |
133 } | 133 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 ContentSettingsPattern::Wildcard() : | 369 ContentSettingsPattern::Wildcard() : |
370 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()); | 370 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()); |
371 | 371 |
372 profile_->GetHostContentSettingsMap()->SetContentSetting( | 372 profile_->GetHostContentSettingsMap()->SetContentSetting( |
373 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), | 373 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), |
374 embedder_pattern, | 374 embedder_pattern, |
375 type_, | 375 type_, |
376 std::string(), | 376 std::string(), |
377 content_setting); | 377 content_setting); |
378 } | 378 } |
OLD | NEW |