diff options
author | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 16:55:35 +0000 |
---|---|---|
committer | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-12 16:55:35 +0000 |
commit | d03d2e1c530c0329de57e31e76390defe6cad676 (patch) | |
tree | dabe4be9eeb91d810ba2e8daea1995c88acee42d /chrome/browser/invalidation/invalidation_service_factory.h | |
parent | 9ba666117ed56d6ff4b1e058f9027798faa31b22 (diff) | |
download | chromium_src-d03d2e1c530c0329de57e31e76390defe6cad676.zip chromium_src-d03d2e1c530c0329de57e31e76390defe6cad676.tar.gz chromium_src-d03d2e1c530c0329de57e31e76390defe6cad676.tar.bz2 |
Introduce ProfileInvalidationProvider wrapper for InvalidationService
TiclInvalidationService was refactored to no longer depend on Profile.
However, it still is a KeyedService. While this does actually pull in
Profile as a dependency, it implies that TiclInvalidationService should
be considered a per-Profile service, like the other KeyedServices in
Chrome's code base.
This CL introduces ProfileInvalidationProvider, a KeyedService that is a
tiny wrapper around an InvalidationService. Given this wrapper,
InvalidationService (and with it, TiclInvalidationService) no longer have
to be KeyedServices.
BUG=362083
TEST=Updated unit and browser tests
TBR=dcheng (chrome/browser/extensions/api/push_messaging/*)
TBR=davemoore (chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc)
TBR=arv (chrome/browser/ui/webui/invalidations_message_handler.cc)
Review URL: https://codereview.chromium.org/327243003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/invalidation/invalidation_service_factory.h')
-rw-r--r-- | chrome/browser/invalidation/invalidation_service_factory.h | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/chrome/browser/invalidation/invalidation_service_factory.h b/chrome/browser/invalidation/invalidation_service_factory.h deleted file mode 100644 index a82ed4c..0000000 --- a/chrome/browser/invalidation/invalidation_service_factory.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2013 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. - -#ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ -#define CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ - -#include "base/basictypes.h" -#include "base/memory/singleton.h" -#include "components/keyed_service/content/browser_context_keyed_service_factory.h" - -namespace user_prefs { -class PrefRegistrySyncable; -} - -namespace syncer { -class Invalidator; -} - -class Profile; - -namespace invalidation { - -class FakeInvalidationService; -class InvalidationService; -class P2PInvalidationService; - -// A BrowserContextKeyedServiceFactory to construct InvalidationServices. The -// implementation of the InvalidationService may be completely different on -// different platforms; this class should help to hide this complexity. It also -// exposes some factory methods that are useful for setting up tests that rely -// on invalidations. -class InvalidationServiceFactory : public BrowserContextKeyedServiceFactory { - public: - // Returns the InvalidationService for the given |profile|, lazily creating - // one first if required. If |profile| does not support invalidation - // (Chrome OS login profile, Chrome OS guest), returns NULL instead. - static InvalidationService* GetForProfile(Profile* profile); - - static InvalidationServiceFactory* GetInstance(); - - // Switches service creation to go through |testing_factory| for all browser - // contexts. - void RegisterTestingFactory(TestingFactoryFunction testing_factory); - - private: - friend class InvalidationServiceFactoryTestBase; - friend struct DefaultSingletonTraits<InvalidationServiceFactory>; - - InvalidationServiceFactory(); - virtual ~InvalidationServiceFactory(); - - // BrowserContextKeyedServiceFactory: - virtual KeyedService* BuildServiceInstanceFor( - content::BrowserContext* context) const OVERRIDE; - virtual void RegisterProfilePrefs( - user_prefs::PrefRegistrySyncable* registry) OVERRIDE; - - TestingFactoryFunction testing_factory_; - - DISALLOW_COPY_AND_ASSIGN(InvalidationServiceFactory); -}; - -} // namespace invalidation - -#endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_SERVICE_FACTORY_H_ |