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

Unified Diff: chrome/browser/ui/webui/profile_info_watcher.h

Issue 1143963002: Split NTPLoginHandler across chrome://apps and chrome://history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lower Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/profile_info_watcher.h
diff --git a/chrome/browser/ui/webui/profile_info_watcher.h b/chrome/browser/ui/webui/profile_info_watcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..e6df01fc36cbec015e458070b81c5333493ba9ac
--- /dev/null
+++ b/chrome/browser/ui/webui/profile_info_watcher.h
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_WEBUI_PROFILE_INFO_WATCHER_H_
+#define CHROME_BROWSER_UI_WEBUI_PROFILE_INFO_WATCHER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "base/prefs/pref_member.h"
+#include "chrome/browser/profiles/profile_info_cache_observer.h"
+
+class PrefService;
MAD 2015/05/20 19:33:02 Not needed?
Dan Beam 2015/05/20 21:53:23 Done.
+class Profile;
+class SigninManagerBase;
+
+// Watches profiles for changes in their cached info (e.g. the authenticated
+// username changes).
+class ProfileInfoWatcher : public ProfileInfoCacheObserver {
+ public:
+ ProfileInfoWatcher(Profile* profile, const base::Closure& callback);
+ ~ProfileInfoWatcher() override;
+
+ // 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.
+ std::string GetAuthenticatedUsername() const;
+
+ private:
+ // ProfileInfoCacheObserver:
+ void OnProfileAuthInfoChanged(const base::FilePath& profile_path) override;
+
+ // Gets the SigninManagerBase for |profile_|.
+ SigninManagerBase* GetSigninManager() const;
+
+ // Runs |callback_| when a profile changes. No-ops if |GetSigninManager()|
+ // returns nullptr.
+ void RunCallback();
+
+ // Weak reference to the profile this class observes.
+ Profile* const profile_;
+
+ // Called when the authenticated username changes.
+ base::Closure callback_;
+
+ BooleanPrefMember signin_allowed_pref_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProfileInfoWatcher);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_PROFILE_INFO_WATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698