| // Copyright 2017 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_FEATURE_ENGAGEMENT_TRACKER_FACTORY_H_ |
| #define CHROME_BROWSER_FEATURE_ENGAGEMENT_TRACKER_FACTORY_H_ |
| |
| #include "base/macros.h" |
| #include "components/keyed_service/content/browser_context_keyed_service_factory.h" |
| |
| namespace base { |
| template <typename T> |
| struct DefaultSingletonTraits; |
| } // namespace base |
| |
| namespace content { |
| class BrowserContext; |
| } // namespace content |
| |
| namespace feature_engagement { |
| class Tracker; |
| |
| // TrackerFactory is the main client class for interaction with |
| // the feature_engagement component. |
| class TrackerFactory : public BrowserContextKeyedServiceFactory { |
| public: |
| // Returns singleton instance of TrackerFactory. |
| static TrackerFactory* GetInstance(); |
| |
| // Returns the feature_engagement::Tracker associated with |context|. |
| static feature_engagement::Tracker* GetForBrowserContext( |
| content::BrowserContext* context); |
| |
| private: |
| friend struct base::DefaultSingletonTraits<TrackerFactory>; |
| |
| TrackerFactory(); |
| ~TrackerFactory() override; |
| |
| // BrowserContextKeyedServiceFactory overrides: |
| KeyedService* BuildServiceInstanceFor( |
| content::BrowserContext* context) const override; |
| content::BrowserContext* GetBrowserContextToUse( |
| content::BrowserContext* context) const override; |
| |
| DISALLOW_COPY_AND_ASSIGN(TrackerFactory); |
| }; |
| |
| } // namespace feature_engagement |
| |
| #endif // CHROME_BROWSER_FEATURE_ENGAGEMENT_TRACKER_FACTORY_H_ |