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

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

Issue 1806353002: Enhanced Sync Confirmation modal (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_LOGIN_UI_SERVICE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 15 matching lines...) Expand all
26 26
27 // Invoked when the login UI should be closed. This can be invoked if the 27 // Invoked when the login UI should be closed. This can be invoked if the
28 // user takes an action that should display new login UI. 28 // user takes an action that should display new login UI.
29 virtual void CloseUI() = 0; 29 virtual void CloseUI() = 0;
30 protected: 30 protected:
31 virtual ~LoginUI() {} 31 virtual ~LoginUI() {}
32 }; 32 };
33 33
34 // Used when the sync confirmation UI is closed to signify which option was 34 // Used when the sync confirmation UI is closed to signify which option was
35 // selected by the user. 35 // selected by the user.
36 enum SyncConfirmationUIClosedResults { 36 enum SyncConfirmationUIClosedResult {
37 // Open the activity controls URL.
38 OPEN_ACTIVITY_CONTROLS_URL = 1U << 0,
37 // Start sync immediately. 39 // Start sync immediately.
38 SYNC_WITH_DEFAULT_SETTINGS, 40 SYNC_WITH_DEFAULT_SETTINGS = 1U << 1,
39 // Show the user the sync settings before starting sync. 41 // Show the user the sync settings before starting sync.
40 CONFIGURE_SYNC_FIRST, 42 CONFIGURE_SYNC_FIRST = 1U << 2,
41 // The signing process was aborted, don't start sync or show settings. 43 // The signing process was aborted, don't start sync or show settings.
42 ABORT_SIGNIN, 44 ABORT_SIGNIN = 1U << 3,
45
46 DEFAULT_SETTINGS_OPEN_ACTIVITY_CONTROLS_URL = SYNC_WITH_DEFAULT_SETTINGS |
Evan Stade 2016/03/30 22:40:48 don't add these, instead you must change switch/ca
Moe 2016/03/31 19:09:29 Done.
47 OPEN_ACTIVITY_CONTROLS_URL,
48
49 CONFIGURE_FIRST_OPEN_ACTIVITY_CONTROLS_URL = CONFIGURE_SYNC_FIRST |
50 OPEN_ACTIVITY_CONTROLS_URL,
43 }; 51 };
44 52
45 // Interface for obervers of LoginUIService. 53 // Interface for obervers of LoginUIService.
46 class Observer { 54 class Observer {
47 public: 55 public:
48 // Called when a new login UI is shown. 56 // Called when a new login UI is shown.
49 // |ui| The login UI that was just shown. Will never be null. 57 // |ui| The login UI that was just shown. Will never be null.
50 virtual void OnLoginUIShown(LoginUI* ui) {} 58 virtual void OnLoginUIShown(LoginUI* ui) {}
51 59
52 // Called when a login UI is closed. 60 // Called when a login UI is closed.
53 // |ui| The login UI that was just closed; will never be null. 61 // |ui| The login UI that was just closed; will never be null.
54 virtual void OnLoginUIClosed(LoginUI* ui) {} 62 virtual void OnLoginUIClosed(LoginUI* ui) {}
55 63
56 // Called when the sync confirmation UI is closed. |results| indicates the 64 // Called when the sync confirmation UI is closed. |results| indicates the
57 // option chosen by the user in the confirmation UI. 65 // option chosen by the user in the confirmation UI.
58 virtual void OnSyncConfirmationUIClosed( 66 virtual void OnSyncConfirmationUIClosed(
59 SyncConfirmationUIClosedResults results) {} 67 SyncConfirmationUIClosedResult result) {}
60 68
61 // Called when a confirmation UI for untrusted signin is shown. 69 // Called when a confirmation UI for untrusted signin is shown.
62 virtual void OnUntrustedLoginUIShown() {} 70 virtual void OnUntrustedLoginUIShown() {}
63 71
64 protected: 72 protected:
65 virtual ~Observer() {} 73 virtual ~Observer() {}
66 }; 74 };
67 75
68 explicit LoginUIService(Profile* profile); 76 explicit LoginUIService(Profile* profile);
69 ~LoginUIService() override; 77 ~LoginUIService() override;
70 78
71 // Gets the currently active login UI, or null if no login UI is active. 79 // Gets the currently active login UI, or null if no login UI is active.
72 LoginUI* current_login_ui() const { 80 LoginUI* current_login_ui() const {
73 return ui_; 81 return ui_;
74 } 82 }
75 83
76 // |observer| The observer to add or remove; cannot be NULL. 84 // |observer| The observer to add or remove; cannot be NULL.
77 void AddObserver(Observer* observer); 85 void AddObserver(Observer* observer);
78 void RemoveObserver(Observer* observer); 86 void RemoveObserver(Observer* observer);
79 87
80 // Sets the currently active login UI. It is illegal to call this if there is 88 // Sets the currently active login UI. It is illegal to call this if there is
81 // already login UI visible. 89 // already login UI visible.
82 void SetLoginUI(LoginUI* ui); 90 void SetLoginUI(LoginUI* ui);
83 91
84 // Called when login UI is closed. If the passed UI is the current login UI, 92 // Called when login UI is closed. If the passed UI is the current login UI,
85 // sets current_login_ui() to null. 93 // sets current_login_ui() to null.
86 void LoginUIClosed(LoginUI* ui); 94 void LoginUIClosed(LoginUI* ui);
87 95
88 // Called when the sync settings confirmation UI is closed. 96 // Called when the sync settings confirmation UI is closed.
89 void SyncConfirmationUIClosed(SyncConfirmationUIClosedResults results); 97 void SyncConfirmationUIClosed(SyncConfirmationUIClosedResult result);
90 98
91 // Called when a confirmation UI for untrusted signin is shown. 99 // Called when a confirmation UI for untrusted signin is shown.
92 void UntrustedLoginUIShown(); 100 void UntrustedLoginUIShown();
93 101
94 // Delegate to an existing login dialog if one exists. 102 // Delegate to an existing login dialog if one exists.
95 // If not, we make a new popup dialog window, and set it to 103 // If not, we make a new popup dialog window, and set it to
96 // chrome://signin to ask the user to sign in to chrome. 104 // chrome://signin to ask the user to sign in to chrome.
97 void ShowLoginPopup(); 105 void ShowLoginPopup();
98 106
99 // Displays login results. 107 // Displays login results.
100 void DisplayLoginResult(Browser* browser, const base::string16& message); 108 void DisplayLoginResult(Browser* browser, const base::string16& message);
101 109
102 // Gets the last login result set through |DisplayLoginResult|. 110 // Gets the last login result set through |DisplayLoginResult|.
103 const base::string16& GetLastLoginResult(); 111 const base::string16& GetLastLoginResult();
104 112
105 private: 113 private:
106 // Weak pointer to the currently active login UI, or null if none. 114 // Weak pointer to the currently active login UI, or null if none.
107 LoginUI* ui_; 115 LoginUI* ui_;
108 Profile* profile_; 116 Profile* profile_;
109 117
110 // List of observers. 118 // List of observers.
111 base::ObserverList<Observer> observer_list_; 119 base::ObserverList<Observer> observer_list_;
112 120
113 base::string16 last_login_result_; 121 base::string16 last_login_result_;
114 122
115 DISALLOW_COPY_AND_ASSIGN(LoginUIService); 123 DISALLOW_COPY_AND_ASSIGN(LoginUIService);
116 }; 124 };
117 125
118 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ 126 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698