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

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: Clean-up. 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/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list.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"
17 #include "chrome/browser/supervised_user/child_accounts/child_account_status_obs erver.h"
16 #include "chrome/browser/supervised_user/child_accounts/family_info_fetcher.h" 18 #include "chrome/browser/supervised_user/child_accounts/family_info_fetcher.h"
17 #include "chrome/browser/supervised_user/supervised_user_service.h" 19 #include "chrome/browser/supervised_user/supervised_user_service.h"
18 #include "components/keyed_service/core/keyed_service.h" 20 #include "components/keyed_service/core/keyed_service.h"
19 #include "components/signin/core/browser/account_service_flag_fetcher.h" 21 #include "components/signin/core/browser/account_service_flag_fetcher.h"
20 #include "components/signin/core/browser/signin_manager_base.h" 22 #include "components/signin/core/browser/signin_manager_base.h"
21 #include "net/base/backoff_entry.h" 23 #include "net/base/backoff_entry.h"
22 24
23 namespace base { 25 namespace base {
24 class FilePath; 26 class FilePath;
25 } 27 }
26 28
29 namespace user_prefs {
30 class PrefRegistrySyncable;
31 }
32
27 class Profile; 33 class Profile;
28 34
29 // This class handles detection of child accounts (on sign-in as well as on 35 // 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 36 // browser restart), and triggers the appropriate behavior (e.g. enable the
31 // supervised user experience, fetch information about the parent(s)). 37 // supervised user experience, fetch information about the parent(s)).
32 class ChildAccountService : public KeyedService, 38 class ChildAccountService : public KeyedService,
33 public FamilyInfoFetcher::Consumer, 39 public FamilyInfoFetcher::Consumer,
34 public SigninManagerBase::Observer, 40 public SigninManagerBase::Observer,
35 public SupervisedUserService::Delegate { 41 public SupervisedUserService::Delegate {
36 public: 42 public:
37 ~ChildAccountService() override; 43 ~ChildAccountService() override;
38 44
45 // Registers the preferences related to Child Account Service.
Bernhard Bauer 2015/03/10 09:55:12 This comment is redundant.
merkulova 2015/03/10 11:53:57 Done.
46 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
47
39 void Init(); 48 void Init();
40 49
41 // Sets whether the signed-in account is a child account. 50 // Sets whether the signed-in account is a child account.
42 // Public so it can be called on platforms where child account detection 51 // Public so it can be called on platforms where child account detection
43 // happens outside of this class (like Android). 52 // happens outside of this class (like Android).
44 void SetIsChildAccount(bool is_child_account); 53 void SetIsChildAccount(bool is_child_account);
45 54
55 bool IsChildAccountStatusKnown();
56
46 // KeyedService: 57 // KeyedService:
47 void Shutdown() override; 58 void Shutdown() override;
48 59
60 // Adds/removes observer.
61 void AddStatusObserver(ChildAccountStatusObserver* observer);
62 void RemoveStatusObserver(ChildAccountStatusObserver* observer);
63
49 private: 64 private:
50 friend class ChildAccountServiceFactory; 65 friend class ChildAccountServiceFactory;
51 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of 66 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of
52 // this service. 67 // this service.
53 explicit ChildAccountService(Profile* profile); 68 explicit ChildAccountService(Profile* profile);
54 69
55 // SupervisedUserService::Delegate implementation. 70 // SupervisedUserService::Delegate implementation.
56 bool SetActive(bool active) override; 71 bool SetActive(bool active) override;
57 base::FilePath GetBlacklistPath() const override; 72 base::FilePath GetBlacklistPath() const override;
58 GURL GetBlacklistURL() const override; 73 GURL GetBlacklistURL() const override;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_; 117 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_;
103 // If fetching the account service flag fails, retry with exponential backoff. 118 // If fetching the account service flag fails, retry with exponential backoff.
104 base::OneShotTimer<ChildAccountService> flag_fetch_timer_; 119 base::OneShotTimer<ChildAccountService> flag_fetch_timer_;
105 net::BackoffEntry flag_fetch_backoff_; 120 net::BackoffEntry flag_fetch_backoff_;
106 121
107 scoped_ptr<FamilyInfoFetcher> family_fetcher_; 122 scoped_ptr<FamilyInfoFetcher> family_fetcher_;
108 // If fetching the family info fails, retry with exponential backoff. 123 // If fetching the family info fails, retry with exponential backoff.
109 base::OneShotTimer<ChildAccountService> family_fetch_timer_; 124 base::OneShotTimer<ChildAccountService> family_fetch_timer_;
110 net::BackoffEntry family_fetch_backoff_; 125 net::BackoffEntry family_fetch_backoff_;
111 126
127 ObserverList<ChildAccountStatusObserver> observer_list_;
128
112 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; 129 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_;
113 130
114 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); 131 DISALLOW_COPY_AND_ASSIGN(ChildAccountService);
115 }; 132 };
116 133
117 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H _ 134 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698