OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Events starting the sync service. | 93 // Events starting the sync service. |
94 START_FROM_NTP = 1, // Sync was started from the ad in NTP | 94 START_FROM_NTP = 1, // Sync was started from the ad in NTP |
95 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. | 95 START_FROM_WRENCH = 2, // Sync was started from the Wrench menu. |
96 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. | 96 START_FROM_OPTIONS = 3, // Sync was started from Wrench->Options. |
97 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager. | 97 START_FROM_BOOKMARK_MANAGER = 4, // Sync was started from Bookmark manager. |
98 | 98 |
99 // Events regarding cancellation of the signon process of sync. | 99 // Events regarding cancellation of the signon process of sync. |
100 CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting | 100 CANCEL_FROM_SIGNON_WITHOUT_AUTH = 10, // Cancelled before submitting |
101 // username and password. | 101 // username and password. |
102 CANCEL_DURING_SIGNON = 11, // Cancelled after auth. | 102 CANCEL_DURING_SIGNON = 11, // Cancelled after auth. |
103 CANCEL_FROM_CHOOSE_DATA_TYPES = 12, // Cancelled before choosing data | 103 CANCEL_DURING_CONFIGURE = 12, // Cancelled before choosing data |
104 // types and clicking OK. | 104 // types and clicking OK. |
105 // Events resulting in the stoppage of sync service. | 105 // Events resulting in the stoppage of sync service. |
106 STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options. | 106 STOP_FROM_OPTIONS = 20, // Sync was stopped from Wrench->Options. |
107 | 107 |
108 // Miscellaneous events caused by sync service. | 108 // Miscellaneous events caused by sync service. |
109 | 109 |
110 MAX_SYNC_EVENT_CODE | 110 MAX_SYNC_EVENT_CODE |
111 }; | 111 }; |
112 | 112 |
113 // Keep track of where we are when clearing server data. | 113 // Keep track of where we are when clearing server data. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // re-authentication, and returns true if it actually opened the dialog. | 213 // re-authentication, and returns true if it actually opened the dialog. |
214 // Returns false if a dialog is already showing, an auth attempt is in | 214 // Returns false if a dialog is already showing, an auth attempt is in |
215 // progress, the sync system is already authenticated, or some error | 215 // progress, the sync system is already authenticated, or some error |
216 // occurred preventing the action. We make it the duty of ProfileSyncService | 216 // occurred preventing the action. We make it the duty of ProfileSyncService |
217 // to open the dialog to easily ensure only one is ever showing. | 217 // to open the dialog to easily ensure only one is ever showing. |
218 virtual bool SetupInProgress() const; | 218 virtual bool SetupInProgress() const; |
219 bool WizardIsVisible() const { | 219 bool WizardIsVisible() const { |
220 return wizard_.IsVisible(); | 220 return wizard_.IsVisible(); |
221 } | 221 } |
222 virtual void ShowLoginDialog(gfx::NativeWindow parent_window); | 222 virtual void ShowLoginDialog(gfx::NativeWindow parent_window); |
223 | |
224 void ShowChooseDataTypes(gfx::NativeWindow parent_window); | 223 void ShowChooseDataTypes(gfx::NativeWindow parent_window); |
225 | 224 |
226 // Pretty-printed strings for a given StatusSummary. | 225 // Pretty-printed strings for a given StatusSummary. |
227 static std::string BuildSyncStatusSummaryText( | 226 static std::string BuildSyncStatusSummaryText( |
228 const browser_sync::SyncBackendHost::StatusSummary& summary); | 227 const browser_sync::SyncBackendHost::StatusSummary& summary); |
229 | 228 |
230 // Returns true if the SyncBackendHost has told us it's ready to accept | 229 // Returns true if the SyncBackendHost has told us it's ready to accept |
231 // changes. | 230 // changes. |
232 // TODO(timsteele): What happens if the bookmark model is loaded, a change | 231 // TODO(timsteele): What happens if the bookmark model is loaded, a change |
233 // takes place, and the backend isn't initialized yet? | 232 // takes place, and the backend isn't initialized yet? |
(...skipping 26 matching lines...) Expand all Loading... |
260 // Returns the authenticated username of the sync user, or empty if none | 259 // Returns the authenticated username of the sync user, or empty if none |
261 // exists. It will only exist if the authentication service provider (e.g | 260 // exists. It will only exist if the authentication service provider (e.g |
262 // GAIA) has confirmed the username is authentic. | 261 // GAIA) has confirmed the username is authentic. |
263 virtual string16 GetAuthenticatedUsername() const; | 262 virtual string16 GetAuthenticatedUsername() const; |
264 | 263 |
265 const std::string& last_attempted_user_email() const { | 264 const std::string& last_attempted_user_email() const { |
266 return last_attempted_user_email_; | 265 return last_attempted_user_email_; |
267 } | 266 } |
268 | 267 |
269 // The profile we are syncing for. | 268 // The profile we are syncing for. |
270 Profile* profile() { return profile_; } | 269 Profile* profile() const { return profile_; } |
271 | 270 |
272 // Adds/removes an observer. ProfileSyncService does not take ownership of | 271 // Adds/removes an observer. ProfileSyncService does not take ownership of |
273 // the observer. | 272 // the observer. |
274 virtual void AddObserver(Observer* observer); | 273 virtual void AddObserver(Observer* observer); |
275 virtual void RemoveObserver(Observer* observer); | 274 virtual void RemoveObserver(Observer* observer); |
276 | 275 |
277 // Record stats on various events. | 276 // Record stats on various events. |
278 static void SyncEvent(SyncEventCodes code); | 277 static void SyncEvent(SyncEventCodes code); |
279 | 278 |
280 // Returns whether sync is enabled. Sync can be enabled/disabled both | 279 // Returns whether sync is enabled. Sync can be enabled/disabled both |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // should be advertised to the user). These will typically only change | 321 // should be advertised to the user). These will typically only change |
323 // via a command-line option. See class comment for more on what it means | 322 // via a command-line option. See class comment for more on what it means |
324 // for a datatype to be Registered. | 323 // for a datatype to be Registered. |
325 virtual void GetRegisteredDataTypes( | 324 virtual void GetRegisteredDataTypes( |
326 syncable::ModelTypeSet* registered_types) const; | 325 syncable::ModelTypeSet* registered_types) const; |
327 | 326 |
328 // Checks whether the Cryptographer is ready to encrypt and decrypt updates | 327 // Checks whether the Cryptographer is ready to encrypt and decrypt updates |
329 // for sensitive data types. | 328 // for sensitive data types. |
330 virtual bool IsCryptographerReady() const; | 329 virtual bool IsCryptographerReady() const; |
331 | 330 |
| 331 // Returns true if a secondary passphrase is being used. |
| 332 virtual bool IsUsingSecondaryPassphrase() const; |
| 333 |
| 334 // Sets the secondary passphrase. |
| 335 virtual void SetSecondaryPassphrase(const std::string& passphrase); |
| 336 |
332 // Sets the Cryptographer's passphrase, or caches it until that is possible. | 337 // Sets the Cryptographer's passphrase, or caches it until that is possible. |
333 // This will check asynchronously whether the passphrase is valid and notify | 338 // This will check asynchronously whether the passphrase is valid and notify |
334 // ProfileSyncServiceObservers via the NotificationService when the outcome | 339 // ProfileSyncServiceObservers via the NotificationService when the outcome |
335 // is known. | 340 // is known. |
336 virtual void SetPassphrase(const std::string& passphrase); | 341 virtual void SetPassphrase(const std::string& passphrase); |
337 | 342 |
338 // Returns whether processing changes is allowed. Check this before doing | 343 // Returns whether processing changes is allowed. Check this before doing |
339 // any model-modifying operations. | 344 // any model-modifying operations. |
340 bool ShouldPushChanges(); | 345 bool ShouldPushChanges(); |
341 | 346 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 // backend, telling us that it is safe to send a passphrase down ASAP. | 495 // backend, telling us that it is safe to send a passphrase down ASAP. |
491 bool observed_passphrase_required_; | 496 bool observed_passphrase_required_; |
492 | 497 |
493 // Keep track of where we are in a server clear operation | 498 // Keep track of where we are in a server clear operation |
494 ClearServerDataState clear_server_data_state_; | 499 ClearServerDataState clear_server_data_state_; |
495 | 500 |
496 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 501 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
497 }; | 502 }; |
498 | 503 |
499 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 504 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |