summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui/ntp_login_handler.h
diff options
context:
space:
mode:
authorjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-18 16:37:04 +0000
committerjohnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-18 16:37:04 +0000
commit61334a489141172f4ac76d12395e62fa3a3e20e4 (patch)
tree153d0759271bd4e712b5092b9e746f6fbc3bd2ba /chrome/browser/dom_ui/ntp_login_handler.h
parent92b533a37663e7f11b8150b70f8c70814a3ef402 (diff)
downloadchromium_src-61334a489141172f4ac76d12395e62fa3a3e20e4.zip
chromium_src-61334a489141172f4ac76d12395e62fa3a3e20e4.tar.gz
chromium_src-61334a489141172f4ac76d12395e62fa3a3e20e4.tar.bz2
Show the current logged-in username on the NTP.
BUG=58024 TEST=included, for manual test sign into sync then go to NTP Review URL: http://codereview.chromium.org/3784004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui/ntp_login_handler.h')
-rw-r--r--chrome/browser/dom_ui/ntp_login_handler.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/chrome/browser/dom_ui/ntp_login_handler.h b/chrome/browser/dom_ui/ntp_login_handler.h
new file mode 100644
index 0000000..d6eabfe
--- /dev/null
+++ b/chrome/browser/dom_ui/ntp_login_handler.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2010 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_DOM_UI_NTP_LOGIN_HANDLER_H_
+#define CHROME_BROWSER_DOM_UI_NTP_LOGIN_HANDLER_H_
+#pragma once
+
+#include "chrome/browser/dom_ui/dom_ui.h"
+#include "chrome/browser/prefs/pref_member.h"
+#include "chrome/common/notification_observer.h"
+
+// The NTP login handler currently simply displays the current logged in
+// username at the top of the NTP (and update itself when that changes).
+// In the future it may expand to allow users to login from the NTP.
+class NTPLoginHandler : public DOMMessageHandler,
+ public NotificationObserver {
+ public:
+ NTPLoginHandler();
+ ~NTPLoginHandler();
+
+ virtual DOMMessageHandler* Attach(DOMUI* dom_ui);
+
+ // DOMMessageHandler interface
+ virtual void RegisterMessages();
+
+ // NotificationObserver interface
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ // Called from JS when the NTP is loaded.
+ void HandleInitializeLogin(const ListValue* args);
+
+ // Internal helper method
+ void UpdateLogin();
+
+ StringPrefMember username_pref_;
+};
+
+#endif // CHROME_BROWSER_DOM_UI_NTP_LOGIN_HANDLER_H_