| 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 class Profile; | 13 class Profile; |
| 14 class Browser; |
| 14 | 15 |
| 15 // The NTP login handler currently simply displays the current logged in | 16 // The NTP login handler currently simply displays the current logged in |
| 16 // username at the top of the NTP (and update itself when that changes). | 17 // username at the top of the NTP (and update itself when that changes). |
| 17 // In the future it may expand to allow users to login from the NTP. | 18 // In the future it may expand to allow users to login from the NTP. |
| 18 class NTPLoginHandler : public WebUIMessageHandler, | 19 class NTPLoginHandler : public WebUIMessageHandler, |
| 19 public NotificationObserver { | 20 public NotificationObserver { |
| 20 public: | 21 public: |
| 21 NTPLoginHandler(); | 22 NTPLoginHandler(); |
| 22 virtual ~NTPLoginHandler(); | 23 virtual ~NTPLoginHandler(); |
| 23 | 24 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 41 void HandleInitializeSyncLogin(const ListValue* args); | 42 void HandleInitializeSyncLogin(const ListValue* args); |
| 42 | 43 |
| 43 // Called from JS when the user clicks the login container. It shows the | 44 // Called from JS when the user clicks the login container. It shows the |
| 44 // appropriate UI based on the current sync state. |args| is the list of | 45 // appropriate UI based on the current sync state. |args| is the list of |
| 45 // arguments passed from JS and should be an empty list. | 46 // arguments passed from JS and should be an empty list. |
| 46 void HandleShowSyncLoginUI(const ListValue* args); | 47 void HandleShowSyncLoginUI(const ListValue* args); |
| 47 | 48 |
| 48 // Internal helper method | 49 // Internal helper method |
| 49 void UpdateLogin(); | 50 void UpdateLogin(); |
| 50 | 51 |
| 52 // Gets the browser window that's currently hosting the new tab page. |
| 53 Browser* GetBrowser(); |
| 54 |
| 51 StringPrefMember username_pref_; | 55 StringPrefMember username_pref_; |
| 52 }; | 56 }; |
| 53 | 57 |
| 54 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ | 58 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ |
| OLD | NEW |