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

Unified Diff: chrome/browser/services/gcm/gcm_permission_context_factory.cc

Issue 343743004: Implement a permission check for push. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased and addressed Michael's comments Created 6 years, 6 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/services/gcm/gcm_permission_context_factory.cc
diff --git a/chrome/browser/services/gcm/gcm_permission_context_factory.cc b/chrome/browser/services/gcm/gcm_permission_context_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fe15a0f40c28a24e5379e3b4713bd53c5400ce4a
--- /dev/null
+++ b/chrome/browser/services/gcm/gcm_permission_context_factory.cc
@@ -0,0 +1,44 @@
+// Copyright 2014 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/services/gcm/gcm_permission_context_factory.h"
+
+#include "chrome/browser/profiles/incognito_helpers.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/services/gcm/gcm_permission_context.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+
+namespace gcm {
+// static
+GCMPermissionContext* GCMPermissionContextFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<GCMPermissionContext*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+// static
+GCMPermissionContextFactory* GCMPermissionContextFactory::GetInstance() {
+ return Singleton<GCMPermissionContextFactory>::get();
+}
+
+GCMPermissionContextFactory::GCMPermissionContextFactory()
+ : BrowserContextKeyedServiceFactory(
+ "GCMPermissionContext",
+ BrowserContextDependencyManager::GetInstance()) {
+}
+
+GCMPermissionContextFactory::~GCMPermissionContextFactory() {
+}
+
+KeyedService* GCMPermissionContextFactory::BuildServiceInstanceFor(
+ content::BrowserContext* profile) const {
+ return new GCMPermissionContext(static_cast<Profile*>(profile));
+}
+
+content::BrowserContext* GCMPermissionContextFactory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
+ return chrome::GetBrowserContextOwnInstanceInIncognito(context);
+}
+
+} // namespace gcm

Powered by Google App Engine
This is Rietveld 408576698