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

Side by Side Diff: chrome/browser/ui/webui/settings/profile_info_handler.h

Issue 1900913002: Settings People Revamp: Split Profile Info out into its own handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_PROFILE_INFO_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_PROFILE_INFO_HANDLER_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "build/build_config.h"
12 #include "chrome/browser/profiles/profile_attributes_storage.h"
13 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
14
15 #if defined(OS_CHROMEOS)
16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h"
18 #endif
19
20 class Profile;
21
22 namespace settings {
23
24 class ProfileInfoHandler : public SettingsPageUIHandler,
25 #if defined(OS_CHROMEOS)
26 public content::NotificationObserver,
27 #endif
28 public ProfileAttributesStorage::Observer {
29 public:
30 explicit ProfileInfoHandler(Profile* profile);
31 ~ProfileInfoHandler() override {}
32
33 // SettingsPageUIHandler implementation.
34 void RegisterMessages() override;
35 void RenderViewReused() override;
36
37 #if defined(OS_CHROMEOS)
38 // content::NotificationObserver implementation.
39 void Observe(int type,
40 const content::NotificationSource& source,
41 const content::NotificationDetails& details) override;
42 #endif
43
44 // ProfileAttributesStorage::Observer implementation.
45 void OnProfileNameChanged(const base::FilePath& profile_path,
46 const base::string16& old_profile_name) override;
47 void OnProfileAvatarChanged(const base::FilePath& profile_path) override;
48
49 private:
50 FRIEND_TEST_ALL_PREFIXES(ProfileInfoHandlerTest, GetProfileInfo);
51 FRIEND_TEST_ALL_PREFIXES(ProfileInfoHandlerTest, PushProfileInfo);
52
53 // Callbacks from the page.
54 void HandleGetProfileInfo(const base::ListValue* args);
55
56 void PushProfileInfo();
57
58 std::unique_ptr<base::DictionaryValue> GetAccountNameAndIcon() const;
59
60 // Weak pointer.
61 Profile* profile_;
62
63 #if defined(OS_CHROMEOS)
64 // Used to listen to ChromeOS user image changes.
65 content::NotificationRegistrar registrar_;
66 #endif
67
68 bool observers_registered_;
69
70 DISALLOW_COPY_AND_ASSIGN(ProfileInfoHandler);
71 };
72
73 } // namespace settings
74
75 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PROFILE_INFO_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698