Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2129)

Unified Diff: chrome/browser/content_settings/permission_context.cc

Issue 990303002: Implement PermissionService::GetNextPermissionChange. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission_impl
Patch Set: review comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/permission_context.cc
diff --git a/chrome/browser/content_settings/permission_context.cc b/chrome/browser/content_settings/permission_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..269767340cf04145655114fd12be7dfa5d4a243e
--- /dev/null
+++ b/chrome/browser/content_settings/permission_context.cc
@@ -0,0 +1,63 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/content_settings/permission_context.h"
+
+#include "chrome/browser/geolocation/geolocation_permission_context.h"
+#include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
+#include "chrome/browser/media/midi_permission_context.h"
+#include "chrome/browser/media/midi_permission_context_factory.h"
+#include "chrome/browser/notifications/desktop_notification_service.h"
+#include "chrome/browser/notifications/desktop_notification_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/push_messaging/push_messaging_permission_context.h"
+#include "chrome/browser/push_messaging/push_messaging_permission_context_factory.h"
+
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#include "chrome/browser/media/protected_media_identifier_permission_context.h"
+#include "chrome/browser/media/protected_media_identifier_permission_context_factory.h"
+#endif
+
+// static
+PermissionContextBase* PermissionContext::Get(
+ Profile* profile,
+ ContentSettingsType content_settings_type) {
+ // NOTE: the factories used in this method have to stay in sync with
+ // ::GetFactories() below.
+ switch (content_settings_type) {
+ case CONTENT_SETTINGS_TYPE_GEOLOCATION:
+ return GeolocationPermissionContextFactory::GetForProfile(profile);
+ case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
+ return DesktopNotificationServiceFactory::GetForProfile(profile);
+ case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
+ return MidiPermissionContextFactory::GetForProfile(profile);
+ case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
+ return PushMessagingPermissionContextFactory::GetForProfile(profile);
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+ case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
+ return ProtectedMediaIdentifierPermissionContextFactory::GetForProfile(
+ profile);
+#endif
+ default:
+ NOTREACHED() << "No PermissionContext associated with "
+ << content_settings_type;
+ break;
+ }
+
+ return nullptr;
+}
+
+// static
+std::list<KeyedServiceBaseFactory*> PermissionContext::GetFactories() {
+ // NOTE: this list has to stay in sync with the factories used by ::Get().
+ return {
+ GeolocationPermissionContextFactory::GetInstance(),
+ DesktopNotificationServiceFactory::GetInstance(),
+ MidiPermissionContextFactory::GetInstance(),
+ PushMessagingPermissionContextFactory::GetInstance(),
+#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+ ProtectedMediaIdentifierPermissionContextFactory::GetInstance(),
+#endif
+ };
+}

Powered by Google App Engine
This is Rietveld 408576698