OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/prefs/pref_member.h" | 9 #include "chrome/browser/prefs/pref_member.h" |
10 #include "content/browser/webui/web_ui.h" | 10 #include "content/browser/webui/web_ui.h" |
11 #include "content/common/notification_observer.h" | 11 #include "content/common/notification_observer.h" |
12 | 12 |
13 // The NTP login handler currently simply displays the current logged in | 13 // The NTP login handler currently simply displays the current logged in |
14 // username at the top of the NTP (and update itself when that changes). | 14 // username at the top of the NTP (and update itself when that changes). |
15 // In the future it may expand to allow users to login from the NTP. | 15 // In the future it may expand to allow users to login from the NTP. |
16 class NTPLoginHandler : public WebUIMessageHandler, | 16 class NTPLoginHandler : public WebUIMessageHandler, |
17 public NotificationObserver { | 17 public NotificationObserver { |
18 public: | 18 public: |
19 NTPLoginHandler(); | 19 NTPLoginHandler(); |
20 ~NTPLoginHandler(); | 20 virtual ~NTPLoginHandler(); |
21 | 21 |
22 virtual WebUIMessageHandler* Attach(WebUI* web_ui); | 22 virtual WebUIMessageHandler* Attach(WebUI* web_ui); |
23 | 23 |
24 // WebUIMessageHandler interface | 24 // WebUIMessageHandler interface |
25 virtual void RegisterMessages(); | 25 virtual void RegisterMessages(); |
26 | 26 |
27 // NotificationObserver interface | 27 // NotificationObserver interface |
28 virtual void Observe(NotificationType type, | 28 virtual void Observe(NotificationType type, |
29 const NotificationSource& source, | 29 const NotificationSource& source, |
30 const NotificationDetails& details); | 30 const NotificationDetails& details); |
31 | 31 |
32 private: | 32 private: |
33 // Called from JS when the NTP is loaded. | 33 // Called from JS when the NTP is loaded. |
34 void HandleInitializeLogin(const ListValue* args); | 34 void HandleInitializeLogin(const ListValue* args); |
35 | 35 |
36 // Internal helper method | 36 // Internal helper method |
37 void UpdateLogin(); | 37 void UpdateLogin(); |
38 | 38 |
39 StringPrefMember username_pref_; | 39 StringPrefMember username_pref_; |
40 }; | 40 }; |
41 | 41 |
42 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ | 42 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ |
OLD | NEW |