| // Copyright 2018 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 COMPONENTS_UNIFIED_CONSENT_UNIFIED_CONSENT_SERVICE_H_ |
| #define COMPONENTS_UNIFIED_CONSENT_UNIFIED_CONSENT_SERVICE_H_ |
| |
| #include <memory> |
| |
| #include "base/macros.h" |
| #include "base/observer_list.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| #include "services/identity/public/cpp/identity_manager.h" |
| |
| namespace user_prefs { |
| class PrefRegistrySyncable; |
| } |
| class PrefService; |
| |
| // A browser-context keyed service that is used to manage the user consent |
| // when UnifiedConsent feature is enabled. |
| class UnifiedConsentService : public KeyedService, |
| public identity::IdentityManager::Observer { |
| public: |
| UnifiedConsentService(PrefService* pref_service, |
| identity::IdentityManager* identity_manager); |
| ~UnifiedConsentService() override; |
| |
| // Register the prefs used by this UnifiedConsentService. |
| static void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry); |
| |
| // KeyedService: |
| void Shutdown() override; |
| |
| // IdentityManager::Observer: |
| void OnPrimaryAccountCleared( |
| const AccountInfo& previous_primary_account_info) override; |
| |
| private: |
| PrefService* pref_service_; |
| identity::IdentityManager* identity_manager_; |
| |
| DISALLOW_COPY_AND_ASSIGN(UnifiedConsentService); |
| }; |
| |
| #endif // COMPONENTS_UNIFIED_CONSENT_UNIFIED_CONSENT_SERVICE_H_ |