blob: 4b614097f7f69361c5702d8463d812fc4d2d40b3 [file] [log] [blame]
// 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 <memory>
#include <string>
#include "base/macros.h"
#include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
namespace base {
template <typename T>
struct DefaultSingletonTraits;
namespace gcm {
class GCMProfileService;
namespace ios {
class ChromeBrowserState;
// Singleton that owns all GCMProfileService and associates them with
// ios::ChromeBrowserState.
class IOSChromeGCMProfileServiceFactory
: public BrowserStateKeyedServiceFactory {
static gcm::GCMProfileService* GetForBrowserState(
ios::ChromeBrowserState* browser_state);
static IOSChromeGCMProfileServiceFactory* GetInstance();
// Returns a string like "" that should be used as the GCM
// category when an app_id is sent as a subtype instead of as a category. This
// string must never change during the lifetime of a Chrome install, since
// e.g. to unregister an Instance ID token the same category must be passed to
// GCM as was originally passed when registering it.
static std::string GetProductCategoryForSubtypes();
friend struct base::DefaultSingletonTraits<IOSChromeGCMProfileServiceFactory>;
~IOSChromeGCMProfileServiceFactory() override;
// BrowserStateKeyedServiceFactory:
std::unique_ptr<KeyedService> BuildServiceInstanceFor(
web::BrowserState* context) const override;