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

Side by Side Diff: chrome/browser/sync/profile_sync_service.h

Issue 6375007: [Sync] Refactored ProfileSyncService and remove its backend() function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment Created 9 years, 11 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 | Annotate | Revision Log
OLDNEW
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 // Returns whether sync is managed, i.e. controlled by configuration 320 // Returns whether sync is managed, i.e. controlled by configuration
321 // management. If so, the user is not allowed to configure sync. 321 // management. If so, the user is not allowed to configure sync.
322 bool IsManaged(); 322 bool IsManaged();
323 323
324 // UnrecoverableErrorHandler implementation. 324 // UnrecoverableErrorHandler implementation.
325 virtual void OnUnrecoverableError( 325 virtual void OnUnrecoverableError(
326 const tracked_objects::Location& from_here, 326 const tracked_objects::Location& from_here,
327 const std::string& message); 327 const std::string& message);
328 328
329 browser_sync::SyncBackendHost* backend() { return backend_.get(); } 329 // The functions below (until ActivateDataType()) should only be
330 // called if sync_initialized() is true.
331
332 // TODO(akalin): This is called mostly by ModelAssociators and
333 // tests. Figure out how to pass the handle to the ModelAssociators
334 // directly, figure out how to expose this to tests, and remove this
335 // function.
336 sync_api::UserShare* GetUserShare() const;
337
338 // TODO(akalin): These two functions are used only by
339 // ProfileSyncServiceHarness. Figure out a different way to expose
340 // this info to that class, and remove these functions.
341
342 const browser_sync::sessions::SyncSessionSnapshot*
343 GetLastSessionSnapshot() const;
344
345 // Returns whether or not the underlying sync engine has made any
346 // local changes to items that have not yet been synced with the
347 // server.
348 bool HasUnsyncedItems() const;
349
350 // Get the current routing information for all enabled model types.
351 // If a model type is not enabled (that is, if the syncer should not
352 // be trying to sync it), it is not in this map.
353 //
354 // TODO(akalin): This function is used by
355 // sync_ui_util::ConstructAboutInformation() and by some test
356 // classes. Figure out a different way to expose this info and
357 // remove this function.
358 void GetModelSafeRoutingInfo(browser_sync::ModelSafeRoutingInfo* out);
359
360 // TODO(akalin): Remove these four functions once we're done with
361 // autofill migration.
362
363 syncable::AutofillMigrationState
364 GetAutofillMigrationState();
365
366 void SetAutofillMigrationState(
367 syncable::AutofillMigrationState state);
368
369 syncable::AutofillMigrationDebugInfo
370 GetAutofillMigrationDebugInfo();
371
372 void SetAutofillMigrationDebugInfo(
373 syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set,
374 const syncable::AutofillMigrationDebugInfo& info);
330 375
331 virtual void ActivateDataType( 376 virtual void ActivateDataType(
332 browser_sync::DataTypeController* data_type_controller, 377 browser_sync::DataTypeController* data_type_controller,
333 browser_sync::ChangeProcessor* change_processor); 378 browser_sync::ChangeProcessor* change_processor);
334 virtual void DeactivateDataType( 379 virtual void DeactivateDataType(
335 browser_sync::DataTypeController* data_type_controller, 380 browser_sync::DataTypeController* data_type_controller,
336 browser_sync::ChangeProcessor* change_processor); 381 browser_sync::ChangeProcessor* change_processor);
337 382
338 // NotificationObserver implementation. 383 // NotificationObserver implementation.
339 virtual void Observe(NotificationType type, 384 virtual void Observe(NotificationType type,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 const std::string& cros_user() const { return cros_user_; } 440 const std::string& cros_user() const { return cros_user_; }
396 441
397 protected: 442 protected:
398 // Used by ProfileSyncServiceMock only. 443 // Used by ProfileSyncServiceMock only.
399 // 444 //
400 // TODO(akalin): Separate this class out into an abstract 445 // TODO(akalin): Separate this class out into an abstract
401 // ProfileSyncService interface and a ProfileSyncServiceImpl class 446 // ProfileSyncService interface and a ProfileSyncServiceImpl class
402 // so we don't need this hack anymore. 447 // so we don't need this hack anymore.
403 ProfileSyncService(); 448 ProfileSyncService();
404 449
450 // Used by test classes that derive from ProfileSyncService.
451 virtual browser_sync::SyncBackendHost* GetBackendForTest();
452
405 // Helper to install and configure a data type manager. 453 // Helper to install and configure a data type manager.
406 void ConfigureDataTypeManager(); 454 void ConfigureDataTypeManager();
407 455
408 // Starts up the backend sync components. 456 // Starts up the backend sync components.
409 void StartUp(); 457 void StartUp();
410 // Shuts down the backend sync components. 458 // Shuts down the backend sync components.
411 // |sync_disabled| indicates if syncing is being disabled or not. 459 // |sync_disabled| indicates if syncing is being disabled or not.
412 void Shutdown(bool sync_disabled); 460 void Shutdown(bool sync_disabled);
413 461
414 // Methods to register and remove preferences. 462 // Methods to register and remove preferences.
415 void RegisterPreferences(); 463 void RegisterPreferences();
416 void ClearPreferences(); 464 void ClearPreferences();
417 465
418 // Return SyncCredentials from the TokenService. 466 // Return SyncCredentials from the TokenService.
419 sync_api::SyncCredentials GetCredentials(); 467 sync_api::SyncCredentials GetCredentials();
420 468
421 // Test need to override this to create backends that allow setting up 469 // Test need to override this to create backends that allow setting up
422 // initial conditions, such as populating sync nodes. 470 // initial conditions, such as populating sync nodes.
471 //
472 // TODO(akalin): Figure out a better way to do this. Ideally, we'd
473 // construct the backend outside this class and pass it in to the
474 // contructor or Initialize().
423 virtual void CreateBackend(); 475 virtual void CreateBackend();
424 476
425 const browser_sync::DataTypeController::TypeMap& data_type_controllers() { 477 const browser_sync::DataTypeController::TypeMap& data_type_controllers() {
426 return data_type_controllers_; 478 return data_type_controllers_;
427 } 479 }
428 480
429 // The wizard will try to read the auth state out of the profile sync 481 // The wizard will try to read the auth state out of the profile sync
430 // service using this member. Captcha and error state are reflected. 482 // service using this member. Captcha and error state are reflected.
431 GoogleServiceAuthError last_auth_error_; 483 GoogleServiceAuthError last_auth_error_;
432 484
(...skipping 14 matching lines...) Expand all
447 499
448 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the 500 // Whether we have seen a SYNC_PASSPHRASE_REQUIRED since initializing the
449 // backend, telling us that it is safe to send a passphrase down ASAP. 501 // backend, telling us that it is safe to send a passphrase down ASAP.
450 bool observed_passphrase_required_; 502 bool observed_passphrase_required_;
451 503
452 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it 504 // Was the last SYNC_PASSPHRASE_REQUIRED notification sent because it
453 // was required for decryption? 505 // was required for decryption?
454 bool passphrase_required_for_decryption_; 506 bool passphrase_required_for_decryption_;
455 507
456 private: 508 private:
457 friend class ProfileSyncServiceTest;
458 friend class ProfileSyncServicePasswordTest; 509 friend class ProfileSyncServicePasswordTest;
459 friend class ProfileSyncServicePreferenceTest; 510 friend class TestProfileSyncService;
460 friend class ProfileSyncServiceSessionTest;
461 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState); 511 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest, InitialState);
462 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTest,
463 UnrecoverableErrorSuspendsService);
464 512
465 // If |delete_sync_data_folder| is true, then this method will delete all 513 // If |delete_sync_data_folder| is true, then this method will delete all
466 // previous "Sync Data" folders. (useful if the folder is partial/corrupt). 514 // previous "Sync Data" folders. (useful if the folder is partial/corrupt).
467 void InitializeBackend(bool delete_sync_data_folder); 515 void InitializeBackend(bool delete_sync_data_folder);
468 516
469 // Initializes the various settings from the command line. 517 // Initializes the various settings from the command line.
470 void InitSettings(); 518 void InitSettings();
471 519
472 // Sets the last synced time to the current time. 520 // Sets the last synced time to the current time.
473 void UpdateLastSyncedTime(); 521 void UpdateLastSyncedTime();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 // and is necessary because the nudge sync framework can drop nudges for 626 // and is necessary because the nudge sync framework can drop nudges for
579 // a wide variety of sync-related conditions (throttling, connections issues, 627 // a wide variety of sync-related conditions (throttling, connections issues,
580 // syncer paused, etc.). It can only be removed correctly when the framework 628 // syncer paused, etc.). It can only be removed correctly when the framework
581 // is reworked to allow one-shot commands like clearing server data. 629 // is reworked to allow one-shot commands like clearing server data.
582 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_; 630 base::OneShotTimer<ProfileSyncService> clear_server_data_timer_;
583 631
584 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 632 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
585 }; 633 };
586 634
587 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 635 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/typed_url_model_associator.cc ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698