Chromium Code Reviews| 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_APP_LAUNCHER_LOGIN_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_APP_LAUNCHER_LOGIN_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 8 #include "base/prefs/pref_member.h" | 10 #include "base/prefs/pref_member.h" |
| 9 #include "chrome/browser/profiles/profile_info_cache_observer.h" | |
| 10 #include "content/public/browser/web_ui_message_handler.h" | 11 #include "content/public/browser/web_ui_message_handler.h" |
| 11 | 12 |
| 12 class Profile; | 13 class Profile; |
| 14 class ProfileInfoWatcher; | |
| 13 | 15 |
| 14 // The NTP login handler currently simply displays the current logged in | 16 // The login handler currently simply displays the current logged in |
| 15 // 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). |
| 16 // 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. |
| 17 class NTPLoginHandler : public content::WebUIMessageHandler, | 19 class AppLauncherLoginHandler : public content::WebUIMessageHandler { |
| 18 public ProfileInfoCacheObserver { | |
| 19 public: | 20 public: |
| 20 NTPLoginHandler(); | 21 AppLauncherLoginHandler(); |
| 21 ~NTPLoginHandler() override; | 22 ~AppLauncherLoginHandler() override; |
| 22 | 23 |
| 23 // WebUIMessageHandler implementation: | 24 // WebUIMessageHandler implementation: |
| 24 void RegisterMessages() override; | 25 void RegisterMessages() override; |
| 25 | 26 |
| 26 // ProfileInfoCacheObserver implementation: | |
| 27 void OnProfileAuthInfoChanged(const base::FilePath& profile_path) override; | |
| 28 | |
| 29 // Returns true if the login handler should be shown in a new tab page | 27 // Returns true if the login handler should be shown in a new tab page |
| 30 // for the given |profile|. |profile| must not be NULL. | 28 // for the given |profile|. |profile| must not be NULL. |
| 31 static bool ShouldShow(Profile* profile); | 29 static bool ShouldShow(Profile* profile); |
| 32 | 30 |
| 33 // Registers values (strings etc.) for the page. | 31 // Registers values (strings etc.) for the page. |
| 34 static void GetLocalizedValues(Profile* profile, | 32 static void GetLocalizedValues(Profile* profile, |
| 35 base::DictionaryValue* values); | 33 base::DictionaryValue* values); |
| 36 | 34 |
| 37 private: | 35 private: |
| 38 // User actions while on the NTP when clicking on or viewing the sync promo. | 36 // User actions while on the NTP when clicking on or viewing the sync promo. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 59 void HandleLoginMessageSeen(const base::ListValue* args); | 57 void HandleLoginMessageSeen(const base::ListValue* args); |
| 60 | 58 |
| 61 // Called from JS when the user clicks on the advanced link the sync promo NTP | 59 // Called from JS when the user clicks on the advanced link the sync promo NTP |
| 62 // bubble. Use use this to navigate to the sync settings page. |args| is the | 60 // bubble. Use use this to navigate to the sync settings page. |args| is the |
| 63 // list of arguments passed from JS and should be an empty list. | 61 // list of arguments passed from JS and should be an empty list. |
| 64 void HandleShowAdvancedLoginUI(const base::ListValue* args); | 62 void HandleShowAdvancedLoginUI(const base::ListValue* args); |
| 65 | 63 |
| 66 // Internal helper method | 64 // Internal helper method |
| 67 void UpdateLogin(); | 65 void UpdateLogin(); |
| 68 | 66 |
| 69 BooleanPrefMember signin_allowed_pref_; | 67 scoped_ptr<ProfileInfoWatcher> profile_info_watcher_; |
|
MAD
2015/05/20 19:33:02
Maybe add the same comment you added to the histor
Dan Beam
2015/05/20 21:53:23
Done.
| |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(AppLauncherLoginHandler); | |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ | 72 #endif // CHROME_BROWSER_UI_WEBUI_APP_LAUNCHER_LOGIN_HANDLER_H_ |
| OLD | NEW |