1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FEATURE_MANAGER_IMPL_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FEATURE_MANAGER_IMPL_H_
7 
8 #include "base/macros.h"
9 #include "components/password_manager/core/browser/password_feature_manager.h"
10 
11 namespace syncer {
12 class SyncService;
13 }  // namespace syncer
14 
15 class PrefService;
16 
17 namespace password_manager {
18 
19 // Keeps track of which feature of PasswordManager is enabled for a given
20 // profile.
21 class PasswordFeatureManagerImpl : public PasswordFeatureManager {
22  public:
23   PasswordFeatureManagerImpl(PrefService* pref_service,
24                              const syncer::SyncService* sync_service);
25   ~PasswordFeatureManagerImpl() override = default;
26 
27   bool IsGenerationEnabled() const override;
28 
29   bool IsOptedInForAccountStorage() const override;
30   bool ShouldShowAccountStorageOptIn() const override;
31   bool ShouldShowAccountStorageReSignin(
32       const GURL& current_page_url) const override;
33   void OptInToAccountStorage() override;
34   void OptOutOfAccountStorageAndClearSettings() override;
35 
36   bool ShouldShowAccountStorageBubbleUi() const override;
37 
38   void SetDefaultPasswordStore(const PasswordForm::Store& store) override;
39   PasswordForm::Store GetDefaultPasswordStore() const override;
40   metrics_util::PasswordAccountStorageUsageLevel
41   ComputePasswordAccountStorageUsageLevel() const override;
42 
43   void RecordMoveOfferedToNonOptedInUser() override;
44   int GetMoveOfferedToNonOptedInUserCount() const override;
45 
46  private:
47   PrefService* const pref_service_;
48   const syncer::SyncService* const sync_service_;
49   DISALLOW_COPY_AND_ASSIGN(PasswordFeatureManagerImpl);
50 };
51 
52 }  // namespace password_manager
53 
54 #endif  // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FEATURE_MANAGER_IMPL_H_
55