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