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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // re-authentication, and returns true if it actually opened the dialog. | 215 // re-authentication, and returns true if it actually opened the dialog. |
216 // Returns false if a dialog is already showing, an auth attempt is in | 216 // Returns false if a dialog is already showing, an auth attempt is in |
217 // progress, the sync system is already authenticated, or some error | 217 // progress, the sync system is already authenticated, or some error |
218 // occurred preventing the action. We make it the duty of ProfileSyncService | 218 // occurred preventing the action. We make it the duty of ProfileSyncService |
219 // to open the dialog to easily ensure only one is ever showing. | 219 // to open the dialog to easily ensure only one is ever showing. |
220 virtual bool SetupInProgress() const; | 220 virtual bool SetupInProgress() const; |
221 bool WizardIsVisible() const { | 221 bool WizardIsVisible() const { |
222 return wizard_.IsVisible(); | 222 return wizard_.IsVisible(); |
223 } | 223 } |
224 virtual void ShowLoginDialog(gfx::NativeWindow parent_window); | 224 virtual void ShowLoginDialog(gfx::NativeWindow parent_window); |
225 void ShowChooseDataTypes(gfx::NativeWindow parent_window); | 225 void ShowConfigure(gfx::NativeWindow parent_window); |
226 | 226 |
227 // Pretty-printed strings for a given StatusSummary. | 227 // Pretty-printed strings for a given StatusSummary. |
228 static std::string BuildSyncStatusSummaryText( | 228 static std::string BuildSyncStatusSummaryText( |
229 const browser_sync::SyncBackendHost::StatusSummary& summary); | 229 const browser_sync::SyncBackendHost::StatusSummary& summary); |
230 | 230 |
231 // Returns true if the SyncBackendHost has told us it's ready to accept | 231 // Returns true if the SyncBackendHost has told us it's ready to accept |
232 // changes. | 232 // changes. |
233 // TODO(timsteele): What happens if the bookmark model is loaded, a change | 233 // TODO(timsteele): What happens if the bookmark model is loaded, a change |
234 // takes place, and the backend isn't initialized yet? | 234 // takes place, and the backend isn't initialized yet? |
235 bool sync_initialized() const { return backend_initialized_; } | 235 bool sync_initialized() const { return backend_initialized_; } |
236 bool unrecoverable_error_detected() const { | 236 bool unrecoverable_error_detected() const { |
237 return unrecoverable_error_detected_; | 237 return unrecoverable_error_detected_; |
238 } | 238 } |
239 const std::string& unrecoverable_error_message() { | 239 const std::string& unrecoverable_error_message() { |
240 return unrecoverable_error_message_; | 240 return unrecoverable_error_message_; |
241 } | 241 } |
242 tracked_objects::Location unrecoverable_error_location() { | 242 tracked_objects::Location unrecoverable_error_location() { |
243 return unrecoverable_error_location_.get() ? | 243 return unrecoverable_error_location_.get() ? |
244 *unrecoverable_error_location_.get() : tracked_objects::Location(); | 244 *unrecoverable_error_location_.get() : tracked_objects::Location(); |
245 } | 245 } |
246 | 246 |
247 bool UIShouldDepictAuthInProgress() const { | 247 bool UIShouldDepictAuthInProgress() const { |
248 return is_auth_in_progress_; | 248 return is_auth_in_progress_; |
249 } | 249 } |
250 | 250 |
| 251 bool observed_passphrase_required() const { |
| 252 return observed_passphrase_required_; |
| 253 } |
| 254 |
251 // A timestamp marking the last time the service observed a transition from | 255 // A timestamp marking the last time the service observed a transition from |
252 // the SYNCING state to the READY state. Note that this does not reflect the | 256 // the SYNCING state to the READY state. Note that this does not reflect the |
253 // last time we polled the server to see if there were any changes; the | 257 // last time we polled the server to see if there were any changes; the |
254 // timestamp is only snapped when syncing takes place and we download or | 258 // timestamp is only snapped when syncing takes place and we download or |
255 // upload some bookmark entity. | 259 // upload some bookmark entity. |
256 const base::Time& last_synced_time() const { return last_synced_time_; } | 260 const base::Time& last_synced_time() const { return last_synced_time_; } |
257 | 261 |
258 // Returns a user-friendly string form of last synced time (in minutes). | 262 // Returns a user-friendly string form of last synced time (in minutes). |
259 string16 GetLastSyncedTimeString() const; | 263 string16 GetLastSyncedTimeString() const; |
260 | 264 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // service using this member. Captcha and error state are reflected. | 391 // service using this member. Captcha and error state are reflected. |
388 GoogleServiceAuthError last_auth_error_; | 392 GoogleServiceAuthError last_auth_error_; |
389 | 393 |
390 // Our asynchronous backend to communicate with sync components living on | 394 // Our asynchronous backend to communicate with sync components living on |
391 // other threads. | 395 // other threads. |
392 scoped_ptr<browser_sync::SyncBackendHost> backend_; | 396 scoped_ptr<browser_sync::SyncBackendHost> backend_; |
393 | 397 |
394 // Cache of the last name the client attempted to authenticate. | 398 // Cache of the last name the client attempted to authenticate. |
395 std::string last_attempted_user_email_; | 399 std::string last_attempted_user_email_; |
396 | 400 |
| 401 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the |
| 402 // backend, telling us that it is safe to send a passphrase down ASAP. |
| 403 bool observed_passphrase_required_; |
| 404 |
397 private: | 405 private: |
398 friend class ProfileSyncServiceTest; | 406 friend class ProfileSyncServiceTest; |
399 friend class ProfileSyncServicePasswordTest; | 407 friend class ProfileSyncServicePasswordTest; |
400 friend class ProfileSyncServicePreferenceTest; | 408 friend class ProfileSyncServicePreferenceTest; |
401 friend class ProfileSyncServiceSessionTest; | 409 friend class ProfileSyncServiceSessionTest; |
402 friend class ProfileSyncServiceTestHarness; | 410 friend class ProfileSyncServiceTestHarness; |
403 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); | 411 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); |
404 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, | 412 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, |
405 UnrecoverableErrorSuspendsService); | 413 UnrecoverableErrorSuspendsService); |
406 | 414 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 bool expect_sync_configuration_aborted_; | 497 bool expect_sync_configuration_aborted_; |
490 | 498 |
491 scoped_ptr<TokenMigrator> token_migrator_; | 499 scoped_ptr<TokenMigrator> token_migrator_; |
492 | 500 |
493 // Sometimes we need to temporarily hold on to a passphrase because we don't | 501 // Sometimes we need to temporarily hold on to a passphrase because we don't |
494 // yet have a backend to send it to. This happens during initialization as | 502 // yet have a backend to send it to. This happens during initialization as |
495 // we don't StartUp until we have a valid token, which happens after valid | 503 // we don't StartUp until we have a valid token, which happens after valid |
496 // credentials were provided. | 504 // credentials were provided. |
497 std::string cached_passphrase_; | 505 std::string cached_passphrase_; |
498 | 506 |
499 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the | |
500 // backend, telling us that it is safe to send a passphrase down ASAP. | |
501 bool observed_passphrase_required_; | |
502 | |
503 // Keep track of where we are in a server clear operation | 507 // Keep track of where we are in a server clear operation |
504 ClearServerDataState clear_server_data_state_; | 508 ClearServerDataState clear_server_data_state_; |
505 | 509 |
506 // Timeout for the clear data command. This timeout is a temporary hack | 510 // Timeout for the clear data command. This timeout is a temporary hack |
507 // and is necessary becaue the nudge sync framework can drop nudges for | 511 // and is necessary becaue the nudge sync framework can drop nudges for |
508 // a wide variety of sync-related conditions (throttling, connections issues, | 512 // a wide variety of sync-related conditions (throttling, connections issues, |
509 // syncer paused, etc.). It can only be removed correctly when the framework | 513 // syncer paused, etc.). It can only be removed correctly when the framework |
510 // is reworked to allow one-shot commands like clearing server data. | 514 // is reworked to allow one-shot commands like clearing server data. |
511 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; | 515 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; |
512 | 516 |
513 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 517 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
514 }; | 518 }; |
515 | 519 |
516 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 520 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |