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

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: Changing the observer. 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
27 class Profile; 29 class Profile;
28 30
29 // This class handles detection of child accounts (on sign-in as well as on 31 // 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 32 // browser restart), and triggers the appropriate behavior (e.g. enable the
31 // supervised user experience, fetch information about the parent(s)). 33 // supervised user experience, fetch information about the parent(s)).
32 class ChildAccountService : public KeyedService, 34 class ChildAccountService : public KeyedService,
33 public FamilyInfoFetcher::Consumer, 35 public FamilyInfoFetcher::Consumer,
34 public SigninManagerBase::Observer, 36 public SigninManagerBase::Observer,
35 public SupervisedUserService::Delegate { 37 public SupervisedUserService::Delegate {
36 public: 38 public:
37 ~ChildAccountService() override; 39 ~ChildAccountService() override;
38 40
41 enum ChildAccountStatus {
42 CHILD,
43 NON_CHILD,
44 UNKNOWN
45 };
46
39 void Init(); 47 void Init();
40 48
41 // Sets whether the signed-in account is a child account. 49 // Sets whether the signed-in account is a child account.
42 // Public so it can be called on platforms where child account detection 50 // Public so it can be called on platforms where child account detection
43 // happens outside of this class (like Android). 51 // happens outside of this class (like Android).
44 void SetIsChildAccount(bool is_child_account); 52 void SetIsChildAccount(bool is_child_account);
45 53
54 bool IsChildAccountStatusKnown();
55
46 // KeyedService: 56 // KeyedService:
47 void Shutdown() override; 57 void Shutdown() override;
48 58
59 // Adds/removes observer.
60 void AddStatusObserver(ChildAccountStatusObserver* observer);
61 void RemoveStatusObserver(ChildAccountStatusObserver* observer);
62
49 private: 63 private:
50 friend class ChildAccountServiceFactory; 64 friend class ChildAccountServiceFactory;
51 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of 65 // Use |ChildAccountServiceFactory::GetForProfile(...)| to get an instance of
52 // this service. 66 // this service.
53 explicit ChildAccountService(Profile* profile); 67 explicit ChildAccountService(Profile* profile);
54 68
55 // SupervisedUserService::Delegate implementation. 69 // SupervisedUserService::Delegate implementation.
56 bool SetActive(bool active) override; 70 bool SetActive(bool active) override;
57 base::FilePath GetBlacklistPath() const override; 71 base::FilePath GetBlacklistPath() const override;
58 GURL GetBlacklistURL() const override; 72 GURL GetBlacklistURL() const override;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_; 116 scoped_ptr<AccountServiceFlagFetcher> flag_fetcher_;
103 // If fetching the account service flag fails, retry with exponential backoff. 117 // If fetching the account service flag fails, retry with exponential backoff.
104 base::OneShotTimer<ChildAccountService> flag_fetch_timer_; 118 base::OneShotTimer<ChildAccountService> flag_fetch_timer_;
105 net::BackoffEntry flag_fetch_backoff_; 119 net::BackoffEntry flag_fetch_backoff_;
106 120
107 scoped_ptr<FamilyInfoFetcher> family_fetcher_; 121 scoped_ptr<FamilyInfoFetcher> family_fetcher_;
108 // If fetching the family info fails, retry with exponential backoff. 122 // If fetching the family info fails, retry with exponential backoff.
109 base::OneShotTimer<ChildAccountService> family_fetch_timer_; 123 base::OneShotTimer<ChildAccountService> family_fetch_timer_;
110 net::BackoffEntry family_fetch_backoff_; 124 net::BackoffEntry family_fetch_backoff_;
111 125
126 ChildAccountStatus account_status_;
Marc Treib 2015/03/04 16:31:48 Hm, I think this is actually only used to decide U
merkulova 2015/03/04 19:06:49 removed. Moved to pref.
127
128 ObserverList<ChildAccountStatusObserver> observer_list_;
129
112 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_; 130 base::WeakPtrFactory<ChildAccountService> weak_ptr_factory_;
113 131
114 DISALLOW_COPY_AND_ASSIGN(ChildAccountService); 132 DISALLOW_COPY_AND_ASSIGN(ChildAccountService);
115 }; 133 };
116 134
117 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H _ 135 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698