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_ERROR_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_ERROR_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_ERROR_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_ERROR_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/public/browser/web_ui_message_handler.h" | 11 #include "content/public/browser/web_ui_message_handler.h" |
12 | 12 |
13 class Browser; | 13 class Browser; |
14 class ProfileAttributesEntry; | 14 class ProfileAttributesEntry; |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class ListValue; | 17 class ListValue; |
18 } | 18 } |
19 | 19 |
20 class SigninErrorHandler : public content::WebUIMessageHandler { | 20 class SigninErrorHandler : public content::WebUIMessageHandler { |
21 public: | 21 public: |
22 SigninErrorHandler() {} | 22 static SigninErrorHandler* Create(bool is_system_profile); |
pastarmovj
2016/09/21 08:44:10
I think a comment why you need this factory functi
zmin
2016/09/21 16:40:04
Done.
| |
23 ~SigninErrorHandler() override {} | 23 ~SigninErrorHandler() override {} |
24 | 24 |
25 // content::WebUIMessageHandler: | 25 // content::WebUIMessageHandler: |
26 void RegisterMessages() override; | 26 void RegisterMessages() override; |
27 | 27 |
28 // Sets the existing profile entry that has the same username used for signin. | 28 // Sets the existing profile entry that has the same username used for signin. |
29 // This function is called when the signin error is a duplicate account error. | 29 // This function is called when the signin error is a duplicate account error. |
30 void set_duplicate_profile_entry( | 30 void set_duplicate_profile_entry( |
31 const ProfileAttributesEntry* duplicate_profile_entry) { | 31 const ProfileAttributesEntry* duplicate_profile_entry) { |
32 duplicate_profile_entry_ = duplicate_profile_entry; | 32 duplicate_profile_entry_ = duplicate_profile_entry; |
33 } | 33 } |
34 | 34 |
35 protected: | 35 protected: |
36 SigninErrorHandler() {} | |
pastarmovj
2016/09/21 08:44:10
nit: new line after the constructor.
zmin
2016/09/21 16:40:04
Done.
| |
36 // Handles "switch" message from the page. No arguments. | 37 // Handles "switch" message from the page. No arguments. |
37 // This message is sent when the user switches to the existing profile of the | 38 // This message is sent when the user switches to the existing profile of the |
38 // same username used for signin. | 39 // same username used for signin. |
39 virtual void HandleSwitchToExistingProfile(const base::ListValue* args); | 40 virtual void HandleSwitchToExistingProfile(const base::ListValue* args); |
40 | 41 |
41 // Handles "confirm" message from the page. No arguments. | 42 // Handles "confirm" message from the page. No arguments. |
42 // This message is sent when the user acknowledges the signin error. | 43 // This message is sent when the user acknowledges the signin error. |
43 virtual void HandleConfirm(const base::ListValue* args); | 44 virtual void HandleConfirm(const base::ListValue* args); |
44 | 45 |
45 // Handles "learnMore" message from the page. No arguments. | 46 // Handles "learnMore" message from the page. No arguments. |
46 // This message is sent when the user clicks on the "Learn more" link in the | 47 // This message is sent when the user clicks on the "Learn more" link in the |
47 // signin error dialog, which closes the dialog and takes the user to the | 48 // signin error dialog, which closes the dialog and takes the user to the |
48 // Chrome Help page about fixing sync problems. | 49 // Chrome Help page about fixing sync problems. |
49 virtual void HandleLearnMore(const base::ListValue* args); | 50 virtual void HandleLearnMore(const base::ListValue* args); |
50 | 51 |
51 // Handles the web ui message sent when the html content is done being laid | 52 // Handles the web ui message sent when the html content is done being laid |
52 // out and it's time to resize the native view hosting it to fit. |args| is | 53 // out and it's time to resize the native view hosting it to fit. |args| is |
53 // a single integer value for the height the native view should resize to. | 54 // a single integer value for the height the native view should resize to. |
54 virtual void HandleInitializedWithSize(const base::ListValue* args); | 55 virtual void HandleInitializedWithSize(const base::ListValue* args); |
55 | 56 |
56 void CloseDialog(); | 57 virtual void CloseDialog(); |
57 | 58 |
58 private: | 59 private: |
59 const ProfileAttributesEntry* duplicate_profile_entry_ = nullptr; | 60 const ProfileAttributesEntry* duplicate_profile_entry_ = nullptr; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(SigninErrorHandler); | 62 DISALLOW_COPY_AND_ASSIGN(SigninErrorHandler); |
62 }; | 63 }; |
63 | 64 |
65 class SigninErrorWithoutBrowserHandler : public SigninErrorHandler { | |
pastarmovj
2016/09/21 08:44:10
Comment this class please.
zmin
2016/09/21 16:40:04
Done.
| |
66 public: | |
67 SigninErrorWithoutBrowserHandler(); | |
68 | |
69 protected: | |
70 void CloseDialog() override; | |
71 | |
72 private: | |
73 DISALLOW_COPY_AND_ASSIGN(SigninErrorWithoutBrowserHandler); | |
74 }; | |
75 | |
64 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_ERROR_HANDLER_H_ | 76 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_ERROR_HANDLER_H_ |
OLD | NEW |