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

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_login_handler.h

Issue 895803003: [Profiles] Remove the NotificationService from the ProfileInfoCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cait nit Created 5 years, 10 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 unified diff | Download patch
OLDNEW
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 7
8 #include "base/prefs/pref_member.h" 8 #include "base/prefs/pref_member.h"
9 #include "content/public/browser/notification_observer.h" 9 #include "chrome/browser/profiles/profile_info_cache_observer.h"
10 #include "content/public/browser/notification_registrar.h"
11 #include "content/public/browser/web_ui_message_handler.h" 10 #include "content/public/browser/web_ui_message_handler.h"
12 11
13 class Profile; 12 class Profile;
14 13
15 // The NTP login handler currently simply displays the current logged in 14 // 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). 15 // 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. 16 // In the future it may expand to allow users to login from the NTP.
18 class NTPLoginHandler : public content::WebUIMessageHandler, 17 class NTPLoginHandler : public content::WebUIMessageHandler,
19 public content::NotificationObserver { 18 public ProfileInfoCacheObserver {
20 public: 19 public:
21 NTPLoginHandler(); 20 NTPLoginHandler();
22 ~NTPLoginHandler() override; 21 ~NTPLoginHandler() override;
23 22
24 // WebUIMessageHandler interface 23 // WebUIMessageHandler implementation:
25 void RegisterMessages() override; 24 void RegisterMessages() override;
26 25
27 // content::NotificationObserver interface 26 // ProfileInfoCacheObserver implementation:
28 void Observe(int type, 27 void OnProfileUserNameChanged(const base::FilePath& profile_path) override;
29 const content::NotificationSource& source,
30 const content::NotificationDetails& details) override;
31 28
32 // Returns true if the login handler should be shown in a new tab page 29 // Returns true if the login handler should be shown in a new tab page
33 // for the given |profile|. |profile| must not be NULL. 30 // for the given |profile|. |profile| must not be NULL.
34 static bool ShouldShow(Profile* profile); 31 static bool ShouldShow(Profile* profile);
35 32
36 // Registers values (strings etc.) for the page. 33 // Registers values (strings etc.) for the page.
37 static void GetLocalizedValues(Profile* profile, 34 static void GetLocalizedValues(Profile* profile,
38 base::DictionaryValue* values); 35 base::DictionaryValue* values);
39 36
40 private: 37 private:
(...skipping 22 matching lines...) Expand all
63 60
64 // Called from JS when the user clicks on the advanced link the sync promo NTP 61 // Called from JS when the user clicks on the advanced link the sync promo NTP
65 // bubble. Use use this to navigate to the sync settings page. |args| is the 62 // bubble. Use use this to navigate to the sync settings page. |args| is the
66 // list of arguments passed from JS and should be an empty list. 63 // list of arguments passed from JS and should be an empty list.
67 void HandleShowAdvancedLoginUI(const base::ListValue* args); 64 void HandleShowAdvancedLoginUI(const base::ListValue* args);
68 65
69 // Internal helper method 66 // Internal helper method
70 void UpdateLogin(); 67 void UpdateLogin();
71 68
72 BooleanPrefMember signin_allowed_pref_; 69 BooleanPrefMember signin_allowed_pref_;
73 content::NotificationRegistrar registrar_;
74 }; 70 };
75 71
76 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_ 72 #endif // CHROME_BROWSER_UI_WEBUI_NTP_NTP_LOGIN_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698