| 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 28 matching lines...) Expand all Loading... |
| 39 public SupervisedUserService::Delegate { | 39 public SupervisedUserService::Delegate { |
| 40 public: | 40 public: |
| 41 ~ChildAccountService() override; | 41 ~ChildAccountService() override; |
| 42 | 42 |
| 43 static bool IsChildAccountDetectionEnabled(); | 43 static bool IsChildAccountDetectionEnabled(); |
| 44 | 44 |
| 45 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 45 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 46 | 46 |
| 47 void Init(); | 47 void Init(); |
| 48 | 48 |
| 49 // Sets whether the signed-in account is a child account. | |
| 50 // Public so it can be called on platforms where child account detection | |
| 51 // happens outside of this class (like Android). | |
| 52 void SetIsChildAccount(bool is_child_account); | |
| 53 | |
| 54 // Responds whether at least one request for child status was successful. | 49 // Responds whether at least one request for child status was successful. |
| 55 // And we got answer whether the profile belongs to a child account or not. | 50 // And we got answer whether the profile belongs to a child account or not. |
| 56 bool IsChildAccountStatusKnown(); | 51 bool IsChildAccountStatusKnown(); |
| 57 | 52 |
| 58 // KeyedService: | 53 // KeyedService: |
| 59 void Shutdown() override; | 54 void Shutdown() override; |
| 60 | 55 |
| 61 void AddChildStatusReceivedCallback(const base::Closure& callback); | 56 void AddChildStatusReceivedCallback(const base::Closure& callback); |
| 62 | 57 |
| 63 private: | 58 private: |
| 64 friend class ChildAccountServiceFactory; | 59 friend class ChildAccountServiceFactory; |
| 65 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of | 60 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of |
| 66 // this service. | 61 // this service. |
| 67 explicit ChildAccountService(Profile* profile); | 62 explicit ChildAccountService(Profile* profile); |
| 68 | 63 |
| 69 // SupervisedUserService::Delegate implementation. | 64 // SupervisedUserService::Delegate implementation. |
| 70 bool SetActive(bool active) override; | 65 bool SetActive(bool active) override; |
| 71 | 66 |
| 67 // Sets whether the signed-in account is a child account. |
| 68 void SetIsChildAccount(bool is_child_account); |
| 69 |
| 72 // AccountTrackerService::Observer implementation. | 70 // AccountTrackerService::Observer implementation. |
| 73 void OnAccountUpdated(const AccountInfo& info) override; | 71 void OnAccountUpdated(const AccountInfo& info) override; |
| 74 | 72 |
| 75 // FamilyInfoFetcher::Consumer implementation. | 73 // FamilyInfoFetcher::Consumer implementation. |
| 76 void OnGetFamilyMembersSuccess( | 74 void OnGetFamilyMembersSuccess( |
| 77 const std::vector<FamilyInfoFetcher::FamilyMember>& members) override; | 75 const std::vector<FamilyInfoFetcher::FamilyMember>& members) override; |
| 78 void OnFailure(FamilyInfoFetcher::ErrorCode error) override; | 76 void OnFailure(FamilyInfoFetcher::ErrorCode error) override; |
| 79 | 77 |
| 80 void StartFetchingFamilyInfo(); | 78 void StartFetchingFamilyInfo(); |
| 81 void CancelFetchingFamilyInfo(); | 79 void CancelFetchingFamilyInfo(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 101 | 99 |
| 102 // Callbacks to run when the user status becomes known. | 100 // Callbacks to run when the user status becomes known. |
| 103 std::vector<base::Closure> status_received_callback_list_; | 101 std::vector<base::Closure> status_received_callback_list_; |
| 104 | 102 |
| 105 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; | 103 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; |
| 106 | 104 |
| 107 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); | 105 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); |
| 108 }; | 106 }; |
| 109 | 107 |
| 110 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H
_ | 108 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H
_ |
| OLD | NEW |