Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_PROFILE_INFO_WATCHER_H_ | |
| 6 #define CHROME_BROWSER_UI_WEBUI_PROFILE_INFO_WATCHER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/prefs/pref_member.h" | |
| 13 #include "chrome/browser/profiles/profile_info_cache_observer.h" | |
| 14 | |
| 15 class PrefService; | |
|
MAD
2015/05/20 19:33:02
Not needed?
Dan Beam
2015/05/20 21:53:23
Done.
| |
| 16 class Profile; | |
| 17 class SigninManagerBase; | |
| 18 | |
| 19 // Watches profiles for changes in their cached info (e.g. the authenticated | |
| 20 // username changes). | |
| 21 class ProfileInfoWatcher : public ProfileInfoCacheObserver { | |
| 22 public: | |
| 23 ProfileInfoWatcher(Profile* profile, const base::Closure& callback); | |
| 24 ~ProfileInfoWatcher() override; | |
| 25 | |
| 26 // Gets the authenticated username (e.g. username@gmail.com) for |profile|. | |
|
MAD
2015/05/20 19:33:02
profile -> profile_
Dan Beam
2015/05/20 21:53:23
Done.
| |
| 27 std::string GetAuthenticatedUsername() const; | |
| 28 | |
| 29 private: | |
| 30 // ProfileInfoCacheObserver: | |
| 31 void OnProfileAuthInfoChanged(const base::FilePath& profile_path) override; | |
| 32 | |
| 33 // Gets the SigninManagerBase for |profile_|. | |
| 34 SigninManagerBase* GetSigninManager() const; | |
| 35 | |
| 36 // Runs |callback_| when a profile changes. No-ops if |GetSigninManager()| | |
| 37 // returns nullptr. | |
| 38 void RunCallback(); | |
| 39 | |
| 40 // Weak reference to the profile this class observes. | |
| 41 Profile* const profile_; | |
| 42 | |
| 43 // Called when the authenticated username changes. | |
| 44 base::Closure callback_; | |
| 45 | |
| 46 BooleanPrefMember signin_allowed_pref_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(ProfileInfoWatcher); | |
| 49 }; | |
| 50 | |
| 51 #endif // CHROME_BROWSER_UI_WEBUI_PROFILE_INFO_WATCHER_H_ | |
| OLD | NEW |