OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/content_settings/permission_context.h" |
| 6 |
| 7 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 8 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" |
| 9 #include "chrome/browser/media/midi_permission_context.h" |
| 10 #include "chrome/browser/media/midi_permission_context_factory.h" |
| 11 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 12 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/push_messaging/push_messaging_permission_context.h" |
| 15 #include "chrome/browser/push_messaging/push_messaging_permission_context_factor
y.h" |
| 16 |
| 17 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 18 #include "chrome/browser/media/protected_media_identifier_permission_context.h" |
| 19 #include "chrome/browser/media/protected_media_identifier_permission_context_fac
tory.h" |
| 20 #endif |
| 21 |
| 22 namespace PermissionContext { |
| 23 |
| 24 PermissionContextBase* Get(Profile* profile, |
| 25 ContentSettingsType content_settings_type) { |
| 26 switch (content_settings_type) { |
| 27 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 28 return GeolocationPermissionContextFactory::GetForProfile(profile); |
| 29 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 30 return DesktopNotificationServiceFactory::GetForProfile(profile); |
| 31 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 32 return MidiPermissionContextFactory::GetForProfile(profile); |
| 33 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 34 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 35 return ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( |
| 36 profile); |
| 37 #endif |
| 38 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: |
| 39 return PushMessagingPermissionContextFactory::GetForProfile(profile); |
| 40 default: |
| 41 NOTREACHED() << "No PermissionContext associated with " |
| 42 << content_settings_type; |
| 43 break; |
| 44 } |
| 45 |
| 46 return nullptr; |
| 47 } |
| 48 |
| 49 } // namespace PermissionContext |
OLD | NEW |