| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // supervised user experience, fetch information about the parent(s)). | 28 // supervised user experience, fetch information about the parent(s)). |
| 29 class ChildAccountService : public KeyedService, | 29 class ChildAccountService : public KeyedService, |
| 30 public FamilyInfoFetcher::Consumer, | 30 public FamilyInfoFetcher::Consumer, |
| 31 public SigninManagerBase::Observer, | 31 public SigninManagerBase::Observer, |
| 32 public SupervisedUserService::Delegate { | 32 public SupervisedUserService::Delegate { |
| 33 public: | 33 public: |
| 34 virtual ~ChildAccountService(); | 34 virtual ~ChildAccountService(); |
| 35 | 35 |
| 36 void Init(); | 36 void Init(); |
| 37 | 37 |
| 38 // Sets whether the signed-in account is a child account. |
| 39 // Public so it can be called on platforms where child account detection |
| 40 // happens outside of this class (like Android). |
| 41 void SetIsChildAccount(bool is_child_account); |
| 42 |
| 38 // KeyedService: | 43 // KeyedService: |
| 39 virtual void Shutdown() override; | 44 virtual void Shutdown() override; |
| 40 | 45 |
| 41 private: | 46 private: |
| 42 friend class ChildAccountServiceFactory; | 47 friend class ChildAccountServiceFactory; |
| 43 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of | 48 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of |
| 44 // this service. | 49 // this service. |
| 45 explicit ChildAccountService(Profile* profile); | 50 explicit ChildAccountService(Profile* profile); |
| 46 | 51 |
| 47 // SupervisedUserService::Delegate implementation. | 52 // SupervisedUserService::Delegate implementation. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 // FamilyInfoFetcher::Consumer implementation. | 65 // FamilyInfoFetcher::Consumer implementation. |
| 61 virtual void OnGetFamilyMembersSuccess( | 66 virtual void OnGetFamilyMembersSuccess( |
| 62 const std::vector<FamilyInfoFetcher::FamilyMember>& members) override; | 67 const std::vector<FamilyInfoFetcher::FamilyMember>& members) override; |
| 63 virtual void OnFailure(FamilyInfoFetcher::ErrorCode error) override; | 68 virtual void OnFailure(FamilyInfoFetcher::ErrorCode error) override; |
| 64 | 69 |
| 65 void StartFetchingServiceFlags(const std::string& account_id); | 70 void StartFetchingServiceFlags(const std::string& account_id); |
| 66 void CancelFetchingServiceFlags(); | 71 void CancelFetchingServiceFlags(); |
| 67 void OnFlagsFetched(AccountServiceFlagFetcher::ResultCode, | 72 void OnFlagsFetched(AccountServiceFlagFetcher::ResultCode, |
| 68 const std::vector<std::string>& flags); | 73 const std::vector<std::string>& flags); |
| 69 | 74 |
| 70 void SetIsChildAccount(bool is_child_account); | |
| 71 | |
| 72 void PropagateChildStatusToUser(bool is_child); | 75 void PropagateChildStatusToUser(bool is_child); |
| 73 | 76 |
| 74 void SetFirstCustodianPrefs(const FamilyInfoFetcher::FamilyMember& custodian); | 77 void SetFirstCustodianPrefs(const FamilyInfoFetcher::FamilyMember& custodian); |
| 75 void SetSecondCustodianPrefs( | 78 void SetSecondCustodianPrefs( |
| 76 const FamilyInfoFetcher::FamilyMember& custodian); | 79 const FamilyInfoFetcher::FamilyMember& custodian); |
| 77 void ClearFirstCustodianPrefs(); | 80 void ClearFirstCustodianPrefs(); |
| 78 void ClearSecondCustodianPrefs(); | 81 void ClearSecondCustodianPrefs(); |
| 79 | 82 |
| 80 void EnableExperimentalFiltering(); | 83 void EnableExperimentalFiltering(); |
| 81 | 84 |
| 82 // Owns us via the KeyedService mechanism. | 85 // Owns us via the KeyedService mechanism. |
| 83 Profile* profile_; | 86 Profile* profile_; |
| 84 | 87 |
| 85 bool active_; | 88 bool active_; |
| 86 | 89 |
| 87 // The user for which we are currently trying to fetch the child account flag. | 90 // The user for which we are currently trying to fetch the child account flag. |
| 88 // Empty when we are not currently fetching. | 91 // Empty when we are not currently fetching. |
| 89 std::string account_id_; | 92 std::string account_id_; |
| 90 | 93 |
| 91 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_; | 94 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_; |
| 92 | 95 |
| 93 scoped_ptr<FamilyInfoFetcher> family_fetcher_; | 96 scoped_ptr<FamilyInfoFetcher> family_fetcher_; |
| 94 | 97 |
| 95 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; | 98 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; |
| 96 | 99 |
| 97 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); | 100 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); |
| 98 }; | 101 }; |
| 99 | 102 |
| 100 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H
_ | 103 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H
_ |
| OLD | NEW |