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 void SetIsChildAccount(bool is_child_account); | |
Marc Treib
2014/12/10 11:53:27
Please add a comment explaining why this is public
Bernhard Bauer
2014/12/11 09:07:58
Done.
| |
39 | |
38 // KeyedService: | 40 // KeyedService: |
39 virtual void Shutdown() override; | 41 virtual void Shutdown() override; |
40 | 42 |
41 private: | 43 private: |
42 friend class ChildAccountServiceFactory; | 44 friend class ChildAccountServiceFactory; |
43 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of | 45 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of |
44 // this service. | 46 // this service. |
45 explicit ChildAccountService(Profile* profile); | 47 explicit ChildAccountService(Profile* profile); |
46 | 48 |
47 // SupervisedUserService::Delegate implementation. | 49 // SupervisedUserService::Delegate implementation. |
(...skipping 12 matching lines...) Expand all Loading... | |
60 // FamilyInfoFetcher::Consumer implementation. | 62 // FamilyInfoFetcher::Consumer implementation. |
61 virtual void OnGetFamilyMembersSuccess( | 63 virtual void OnGetFamilyMembersSuccess( |
62 const std::vector<FamilyInfoFetcher::FamilyMember>& members) override; | 64 const std::vector<FamilyInfoFetcher::FamilyMember>& members) override; |
63 virtual void OnFailure(FamilyInfoFetcher::ErrorCode error) override; | 65 virtual void OnFailure(FamilyInfoFetcher::ErrorCode error) override; |
64 | 66 |
65 void StartFetchingServiceFlags(const std::string& account_id); | 67 void StartFetchingServiceFlags(const std::string& account_id); |
66 void CancelFetchingServiceFlags(); | 68 void CancelFetchingServiceFlags(); |
67 void OnFlagsFetched(AccountServiceFlagFetcher::ResultCode, | 69 void OnFlagsFetched(AccountServiceFlagFetcher::ResultCode, |
68 const std::vector<std::string>& flags); | 70 const std::vector<std::string>& flags); |
69 | 71 |
70 void SetIsChildAccount(bool is_child_account); | |
71 | |
72 void PropagateChildStatusToUser(bool is_child); | 72 void PropagateChildStatusToUser(bool is_child); |
73 | 73 |
74 void SetFirstCustodianPrefs(const FamilyInfoFetcher::FamilyMember& custodian); | 74 void SetFirstCustodianPrefs(const FamilyInfoFetcher::FamilyMember& custodian); |
75 void SetSecondCustodianPrefs( | 75 void SetSecondCustodianPrefs( |
76 const FamilyInfoFetcher::FamilyMember& custodian); | 76 const FamilyInfoFetcher::FamilyMember& custodian); |
77 void ClearFirstCustodianPrefs(); | 77 void ClearFirstCustodianPrefs(); |
78 void ClearSecondCustodianPrefs(); | 78 void ClearSecondCustodianPrefs(); |
79 | 79 |
80 void EnableExperimentalFiltering(); | 80 void EnableExperimentalFiltering(); |
81 | 81 |
82 // Owns us via the KeyedService mechanism. | 82 // Owns us via the KeyedService mechanism. |
83 Profile* profile_; | 83 Profile* profile_; |
84 | 84 |
85 bool active_; | 85 bool active_; |
86 | 86 |
87 // The user for which we are currently trying to fetch the child account flag. | 87 // The user for which we are currently trying to fetch the child account flag. |
88 // Empty when we are not currently fetching. | 88 // Empty when we are not currently fetching. |
89 std::string account_id_; | 89 std::string account_id_; |
90 | 90 |
91 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_; | 91 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_; |
92 | 92 |
93 scoped_ptr<FamilyInfoFetcher> family_fetcher_; | 93 scoped_ptr<FamilyInfoFetcher> family_fetcher_; |
94 | 94 |
95 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; | 95 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); | 97 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); |
98 }; | 98 }; |
99 | 99 |
100 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H _ | 100 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H _ |
OLD | NEW |