Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: chrome/browser/supervised_user/child_accounts/child_account_service.h

Issue 971383002: Removing FRE UI for unicorn accounts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/callback.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
16 #include "chrome/browser/supervised_user/child_accounts/family_info_fetcher.h" 17 #include "chrome/browser/supervised_user/child_accounts/family_info_fetcher.h"
17 #include "chrome/browser/supervised_user/supervised_user_service.h" 18 #include "chrome/browser/supervised_user/supervised_user_service.h"
18 #include "components/keyed_service/core/keyed_service.h" 19 #include "components/keyed_service/core/keyed_service.h"
19 #include "components/signin/core/browser/account_service_flag_fetcher.h" 20 #include "components/signin/core/browser/account_service_flag_fetcher.h"
20 #include "components/signin/core/browser/signin_manager_base.h" 21 #include "components/signin/core/browser/signin_manager_base.h"
21 #include "net/base/backoff_entry.h" 22 #include "net/base/backoff_entry.h"
22 23
23 namespace base { 24 namespace base {
24 class FilePath; 25 class FilePath;
25 } 26 }
26 27
28 namespace user_prefs {
29 class PrefRegistrySyncable;
30 }
31
27 class Profile; 32 class Profile;
28 33
29 // This class handles detection of child accounts (on sign-in as well as on 34 // This class handles detection of child accounts (on sign-in as well as on
30 // browser restart), and triggers the appropriate behavior (e.g. enable the 35 // browser restart), and triggers the appropriate behavior (e.g. enable the
31 // supervised user experience, fetch information about the parent(s)). 36 // supervised user experience, fetch information about the parent(s)).
32 class ChildAccountService : public KeyedService, 37 class ChildAccountService : public KeyedService,
33 public FamilyInfoFetcher::Consumer, 38 public FamilyInfoFetcher::Consumer,
34 public SigninManagerBase::Observer, 39 public SigninManagerBase::Observer,
35 public SupervisedUserService::Delegate { 40 public SupervisedUserService::Delegate {
36 public: 41 public:
37 ~ChildAccountService() override; 42 ~ChildAccountService() override;
38 43
44 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
45
39 void Init(); 46 void Init();
40 47
41 // Sets whether the signed-in account is a child account. 48 // Sets whether the signed-in account is a child account.
42 // Public so it can be called on platforms where child account detection 49 // Public so it can be called on platforms where child account detection
43 // happens outside of this class (like Android). 50 // happens outside of this class (like Android).
44 void SetIsChildAccount(bool is_child_account); 51 void SetIsChildAccount(bool is_child_account);
45 52
53 bool IsChildAccountStatusKnown();
Denis Kuznetsov (DE-MUC) 2015/03/10 14:40:34 Some comments?
merkulova 2015/03/10 15:00:37 Done.
54
46 // KeyedService: 55 // KeyedService:
47 void Shutdown() override; 56 void Shutdown() override;
48 57
58 void AddChildStatusReceivedCallback(const base::Closure& callback);
59
49 private: 60 private:
50 friend class ChildAccountServiceFactory; 61 friend class ChildAccountServiceFactory;
51 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of 62 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of
52 // this service. 63 // this service.
53 explicit ChildAccountService(Profile* profile); 64 explicit ChildAccountService(Profile* profile);
54 65
55 // SupervisedUserService::Delegate implementation. 66 // SupervisedUserService::Delegate implementation.
56 bool SetActive(bool active) override; 67 bool SetActive(bool active) override;
57 base::FilePath GetBlacklistPath() const override; 68 base::FilePath GetBlacklistPath() const override;
58 GURL GetBlacklistURL() const override; 69 GURL GetBlacklistURL() const override;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_; 113 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_;
103 // If fetching the account service flag fails, retry with exponential backoff. 114 // If fetching the account service flag fails, retry with exponential backoff.
104 base::OneShotTimer<ChildAccountService> flag_fetch_timer_; 115 base::OneShotTimer<ChildAccountService> flag_fetch_timer_;
105 net::BackoffEntry flag_fetch_backoff_; 116 net::BackoffEntry flag_fetch_backoff_;
106 117
107 scoped_ptr<FamilyInfoFetcher> family_fetcher_; 118 scoped_ptr<FamilyInfoFetcher> family_fetcher_;
108 // If fetching the family info fails, retry with exponential backoff. 119 // If fetching the family info fails, retry with exponential backoff.
109 base::OneShotTimer<ChildAccountService> family_fetch_timer_; 120 base::OneShotTimer<ChildAccountService> family_fetch_timer_;
110 net::BackoffEntry family_fetch_backoff_; 121 net::BackoffEntry family_fetch_backoff_;
111 122
123 // Callbacks to run when the user status becomes known.
124 std::vector<base::Closure> status_received_callback_list_;
125
112 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; 126 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_;
113 127
114 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); 128 DISALLOW_COPY_AND_ASSIGN(ChildAccountService);
115 }; 129 };
116 130
117 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H _ 131 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698