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

Side by Side Diff: chrome/browser/ui/webui/signin/signin_error_handler.h

Issue 2351173004: Display local signin error without browser and record the path of selected profile in user manager. (Closed)
Patch Set: cr+fix trybot Created 4 years, 3 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 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 // Create a handler depends on whether the error ui is displayed in browser
23 // window or user manager.
24 static SigninErrorHandler* Create(bool is_system_profile);
25
23 ~SigninErrorHandler() override {} 26 ~SigninErrorHandler() override {}
24 27
25 // content::WebUIMessageHandler: 28 // content::WebUIMessageHandler:
26 void RegisterMessages() override; 29 void RegisterMessages() override;
27 30
28 // Sets the existing profile entry that has the same username used for signin. 31 // 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. 32 // This function is called when the signin error is a duplicate account error.
30 void set_duplicate_profile_entry( 33 void set_duplicate_profile_entry(
31 const ProfileAttributesEntry* duplicate_profile_entry) { 34 const ProfileAttributesEntry* duplicate_profile_entry) {
32 duplicate_profile_entry_ = duplicate_profile_entry; 35 duplicate_profile_entry_ = duplicate_profile_entry;
33 } 36 }
34 37
35 protected: 38 protected:
39 SigninErrorHandler() {}
40
36 // Handles "switch" message from the page. No arguments. 41 // Handles "switch" message from the page. No arguments.
37 // This message is sent when the user switches to the existing profile of the 42 // This message is sent when the user switches to the existing profile of the
38 // same username used for signin. 43 // same username used for signin.
39 virtual void HandleSwitchToExistingProfile(const base::ListValue* args); 44 virtual void HandleSwitchToExistingProfile(const base::ListValue* args);
40 45
41 // Handles "confirm" message from the page. No arguments. 46 // Handles "confirm" message from the page. No arguments.
42 // This message is sent when the user acknowledges the signin error. 47 // This message is sent when the user acknowledges the signin error.
43 virtual void HandleConfirm(const base::ListValue* args); 48 virtual void HandleConfirm(const base::ListValue* args);
44 49
45 // Handles "learnMore" message from the page. No arguments. 50 // Handles "learnMore" message from the page. No arguments.
46 // This message is sent when the user clicks on the "Learn more" link in the 51 // 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 52 // signin error dialog, which closes the dialog and takes the user to the
48 // Chrome Help page about fixing sync problems. 53 // Chrome Help page about fixing sync problems.
49 virtual void HandleLearnMore(const base::ListValue* args); 54 virtual void HandleLearnMore(const base::ListValue* args);
50 55
51 // Handles the web ui message sent when the html content is done being laid 56 // 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 57 // 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. 58 // a single integer value for the height the native view should resize to.
54 virtual void HandleInitializedWithSize(const base::ListValue* args); 59 virtual void HandleInitializedWithSize(const base::ListValue* args);
55 60
56 void CloseDialog(); 61 virtual void CloseDialog();
57 62
58 private: 63 private:
59 const ProfileAttributesEntry* duplicate_profile_entry_ = nullptr; 64 const ProfileAttributesEntry* duplicate_profile_entry_ = nullptr;
60 65
61 DISALLOW_COPY_AND_ASSIGN(SigninErrorHandler); 66 DISALLOW_COPY_AND_ASSIGN(SigninErrorHandler);
62 }; 67 };
63 68
69 // A Web UI message handler for signin error ui that is displayed without
70 // browser window.
71 class SigninErrorWithoutBrowserHandler : public SigninErrorHandler {
72 public:
73 SigninErrorWithoutBrowserHandler();
74
75 protected:
76 void CloseDialog() override;
tommycli 2016/09/21 18:26:59 nit: Such a small difference does not seem worth m
zmin 2016/09/21 21:21:37 I think you're right. There is only one conditiona
77
78 private:
79 DISALLOW_COPY_AND_ASSIGN(SigninErrorWithoutBrowserHandler);
80 };
81
64 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_ERROR_HANDLER_H_ 82 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_SIGNIN_ERROR_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698