OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_SIGNIN_SIGNIN_CREATE_PROFILE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_CREATE_PROFILE_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_CREATE_PROFILE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_CREATE_PROFILE_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/profiles/profile_attributes_storage.h" |
14 #include "chrome/browser/profiles/profile_window.h" | 15 #include "chrome/browser/profiles/profile_window.h" |
15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
16 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
17 #include "content/public/browser/web_ui_message_handler.h" | 18 #include "content/public/browser/web_ui_message_handler.h" |
18 #include "google_apis/gaia/google_service_auth_error.h" | 19 #include "google_apis/gaia/google_service_auth_error.h" |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class DictionaryValue; | 22 class DictionaryValue; |
22 class ListValue; | 23 class ListValue; |
23 } | 24 } |
24 | 25 |
25 #if defined(ENABLE_SUPERVISED_USERS) | 26 #if defined(ENABLE_SUPERVISED_USERS) |
26 class SupervisedUserRegistrationUtility; | 27 class SupervisedUserRegistrationUtility; |
27 #endif | 28 #endif |
28 | 29 |
29 // Handler for the 'create profile' page. | 30 // Handler for the 'create profile' page. |
30 class SigninCreateProfileHandler : public content::WebUIMessageHandler, | 31 class SigninCreateProfileHandler : public content::WebUIMessageHandler, |
31 public content::NotificationObserver { | 32 public content::NotificationObserver, |
| 33 public ProfileAttributesStorage::Observer { |
32 public: | 34 public: |
33 SigninCreateProfileHandler(); | 35 SigninCreateProfileHandler(); |
34 ~SigninCreateProfileHandler() override; | 36 ~SigninCreateProfileHandler() override; |
35 | 37 |
36 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 38 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
37 | 39 |
38 protected: | 40 protected: |
39 FRIEND_TEST_ALL_PREFIXES(SigninCreateProfileHandlerTest, | 41 FRIEND_TEST_ALL_PREFIXES(SigninCreateProfileHandlerTest, |
40 ReturnDefaultProfileNameAndIcons); | 42 ReturnDefaultProfileNameAndIcons); |
41 FRIEND_TEST_ALL_PREFIXES(SigninCreateProfileHandlerTest, | 43 FRIEND_TEST_ALL_PREFIXES(SigninCreateProfileHandlerTest, |
(...skipping 16 matching lines...) Expand all Loading... |
58 #endif | 60 #endif |
59 | 61 |
60 // WebUIMessageHandler implementation. | 62 // WebUIMessageHandler implementation. |
61 void RegisterMessages() override; | 63 void RegisterMessages() override; |
62 | 64 |
63 // content::NotificationObserver implementation: | 65 // content::NotificationObserver implementation: |
64 void Observe(int type, | 66 void Observe(int type, |
65 const content::NotificationSource& source, | 67 const content::NotificationSource& source, |
66 const content::NotificationDetails& details) override; | 68 const content::NotificationDetails& details) override; |
67 | 69 |
| 70 // ProfileAttributesStorage::Observer implementation: |
| 71 void OnProfileAuthInfoChanged(const base::FilePath& profile_path) override; |
| 72 |
68 // Represents the final profile creation status. It is used to map | 73 // Represents the final profile creation status. It is used to map |
69 // the status to the javascript method to be called. | 74 // the status to the javascript method to be called. |
70 enum ProfileCreationStatus { | 75 enum ProfileCreationStatus { |
71 PROFILE_CREATION_SUCCESS, | 76 PROFILE_CREATION_SUCCESS, |
72 PROFILE_CREATION_ERROR, | 77 PROFILE_CREATION_ERROR, |
73 }; | 78 }; |
74 | 79 |
75 // Represents the type of the in progress profile creation operation. | 80 // Represents the type of the in progress profile creation operation. |
76 // It is used to map the type of the profile creation operation to the | 81 // It is used to map the type of the profile creation operation to the |
77 // correct UMA metric name. | 82 // correct UMA metric name. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 250 |
246 content::NotificationRegistrar registrar_; | 251 content::NotificationRegistrar registrar_; |
247 | 252 |
248 base::WeakPtrFactory<SigninCreateProfileHandler> weak_ptr_factory_; | 253 base::WeakPtrFactory<SigninCreateProfileHandler> weak_ptr_factory_; |
249 | 254 |
250 private: | 255 private: |
251 DISALLOW_COPY_AND_ASSIGN(SigninCreateProfileHandler); | 256 DISALLOW_COPY_AND_ASSIGN(SigninCreateProfileHandler); |
252 }; | 257 }; |
253 | 258 |
254 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_CREATE_PROFILE_HANDLER_H_ | 259 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_CREATE_PROFILE_HANDLER_H_ |
OLD | NEW |