OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_SYNC_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // Events starting the sync service. | 105 // Events starting the sync service. |
106 START_FROM_NTP = 1, // Sync was started from the ad in NTP | 106 START_FROM_NTP = 1, // Sync was started from the ad in NTP |
107 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. | 107 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. |
108 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. | 108 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. |
109 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager. | 109 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager. |
110 | 110 |
111 // Events regarding cancellation of the signon process of sync. | 111 // Events regarding cancellation of the signon process of sync. |
112 CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting | 112 CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting |
113 // username and password. | 113 // username and password. |
114 CANCEL_DURING_SIGNON = 11, // Cancelled after auth. | 114 CANCEL_DURING_SIGNON = 11, // Cancelled after auth. |
115 | 115 CANCEL_FROM_CHOOSE_DATA_TYPES = 12, // Cancelled before choosing data |
| 116 // types and clicking OK. |
116 // Events resulting in the stoppage of sync service. | 117 // Events resulting in the stoppage of sync service. |
117 STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options. | 118 STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options. |
118 | 119 |
119 // Miscellaneous events caused by sync service. | 120 // Miscellaneous events caused by sync service. |
120 | 121 |
121 MAX_SYNC_EVENT_CODE | 122 MAX_SYNC_EVENT_CODE |
122 }; | 123 }; |
123 | 124 |
124 // Default sync server URL. | 125 // Default sync server URL. |
125 static const char* kSyncServerUrl; | 126 static const char* kSyncServerUrl; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 virtual void OnSyncCycleCompleted(); | 163 virtual void OnSyncCycleCompleted(); |
163 virtual void OnAuthError(); | 164 virtual void OnAuthError(); |
164 | 165 |
165 // Called when a user enters credentials through UI. | 166 // Called when a user enters credentials through UI. |
166 virtual void OnUserSubmittedAuth(const std::string& username, | 167 virtual void OnUserSubmittedAuth(const std::string& username, |
167 const std::string& password, | 168 const std::string& password, |
168 const std::string& captcha); | 169 const std::string& captcha); |
169 | 170 |
170 // Called when a user chooses which data types to sync as part of the sync | 171 // Called when a user chooses which data types to sync as part of the sync |
171 // setup wizard. |sync_everything| represents whether they chose the | 172 // setup wizard. |sync_everything| represents whether they chose the |
172 // "keep everything synced" option; if true, data_types will be ignored and | 173 // "keep everything synced" option; if true, |chosen_types| will be ignored |
173 // all data types will be synced. |sync_everything| means "sync all current | 174 // and all data types will be synced. |sync_everything| means "sync all |
174 // and future data types." | 175 // current and future data types." |
175 virtual void OnUserChoseDatatypes(bool sync_everything, | 176 virtual void OnUserChoseDatatypes(bool sync_everything, |
176 const syncable::ModelTypeSet& data_types); | 177 const syncable::ModelTypeSet& chosen_types); |
177 | 178 |
178 // Called when a user cancels any setup dialog (login, etc). | 179 // Called when a user cancels any setup dialog (login, etc). |
179 virtual void OnUserCancelledDialog(); | 180 virtual void OnUserCancelledDialog(); |
180 | 181 |
181 // Get various information for displaying in the user interface. | 182 // Get various information for displaying in the user interface. |
182 browser_sync::SyncBackendHost::StatusSummary QuerySyncStatusSummary(); | 183 browser_sync::SyncBackendHost::StatusSummary QuerySyncStatusSummary(); |
183 browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus(); | 184 browser_sync::SyncBackendHost::Status QueryDetailedSyncStatus(); |
184 | 185 |
185 const GoogleServiceAuthError& GetAuthError() const { | 186 const GoogleServiceAuthError& GetAuthError() const { |
186 return last_auth_error_; | 187 return last_auth_error_; |
187 } | 188 } |
188 | 189 |
189 // Displays a dialog for the user to enter GAIA credentials and attempt | 190 // Displays a dialog for the user to enter GAIA credentials and attempt |
190 // re-authentication, and returns true if it actually opened the dialog. | 191 // re-authentication, and returns true if it actually opened the dialog. |
191 // Returns false if a dialog is already showing, an auth attempt is in | 192 // Returns false if a dialog is already showing, an auth attempt is in |
192 // progress, the sync system is already authenticated, or some error | 193 // progress, the sync system is already authenticated, or some error |
193 // occurred preventing the action. We make it the duty of ProfileSyncService | 194 // occurred preventing the action. We make it the duty of ProfileSyncService |
194 // to open the dialog to easily ensure only one is ever showing. | 195 // to open the dialog to easily ensure only one is ever showing. |
195 bool SetupInProgress() const { | 196 bool SetupInProgress() const { |
196 return !HasSyncSetupCompleted() && | 197 return !HasSyncSetupCompleted() && |
197 (WizardIsVisible() || bootstrap_sync_authentication_); | 198 (WizardIsVisible() || bootstrap_sync_authentication_); |
198 } | 199 } |
199 bool WizardIsVisible() const { | 200 bool WizardIsVisible() const { |
200 return wizard_.IsVisible(); | 201 return wizard_.IsVisible(); |
201 } | 202 } |
202 void ShowLoginDialog(); | 203 void ShowLoginDialog(); |
203 | 204 |
| 205 void ShowChooseDataTypes(); |
| 206 |
204 // Pretty-printed strings for a given StatusSummary. | 207 // Pretty-printed strings for a given StatusSummary. |
205 static std::wstring BuildSyncStatusSummaryText( | 208 static std::wstring BuildSyncStatusSummaryText( |
206 const browser_sync::SyncBackendHost::StatusSummary& summary); | 209 const browser_sync::SyncBackendHost::StatusSummary& summary); |
207 | 210 |
208 // Returns true if the SyncBackendHost has told us it's ready to accept | 211 // Returns true if the SyncBackendHost has told us it's ready to accept |
209 // changes. | 212 // changes. |
210 // TODO(timsteele): What happens if the bookmark model is loaded, a change | 213 // TODO(timsteele): What happens if the bookmark model is loaded, a change |
211 // takes place, and the backend isn't initialized yet? | 214 // takes place, and the backend isn't initialized yet? |
212 bool sync_initialized() const { return backend_initialized_; } | 215 bool sync_initialized() const { return backend_initialized_; } |
213 bool unrecoverable_error_detected() const { | 216 bool unrecoverable_error_detected() const { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 450 |
448 NotificationRegistrar registrar_; | 451 NotificationRegistrar registrar_; |
449 | 452 |
450 ScopedRunnableMethodFactory<ProfileSyncService> | 453 ScopedRunnableMethodFactory<ProfileSyncService> |
451 scoped_runnable_method_factory_; | 454 scoped_runnable_method_factory_; |
452 | 455 |
453 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 456 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
454 }; | 457 }; |
455 | 458 |
456 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 459 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |