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

Side by Side Diff: components/browser_sync/profile_sync_service.h

Issue 2732333003: [Sync] ModelTypeStore factory shouldn't require valid PSS to function correctly (Closed)
Patch Set: Address comments Created 3 years, 9 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 COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 5 #ifndef COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
6 #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 6 #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/memory_pressure_listener.h" 18 #include "base/memory/memory_pressure_listener.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/message_loop/message_loop.h" 20 #include "base/message_loop/message_loop.h"
21 #include "base/observer_list.h" 21 #include "base/observer_list.h"
22 #include "base/strings/string16.h" 22 #include "base/strings/string16.h"
23 #include "base/threading/sequenced_worker_pool.h"
23 #include "base/threading/thread.h" 24 #include "base/threading/thread.h"
24 #include "base/time/time.h" 25 #include "base/time/time.h"
25 #include "base/timer/timer.h" 26 #include "base/timer/timer.h"
26 #include "build/build_config.h" 27 #include "build/build_config.h"
27 #include "components/keyed_service/core/keyed_service.h" 28 #include "components/keyed_service/core/keyed_service.h"
28 #include "components/signin/core/browser/gaia_cookie_manager_service.h" 29 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
29 #include "components/signin/core/browser/signin_manager_base.h" 30 #include "components/signin/core/browser/signin_manager_base.h"
30 #include "components/sync/base/experiments.h" 31 #include "components/sync/base/experiments.h"
31 #include "components/sync/base/model_type.h" 32 #include "components/sync/base/model_type.h"
32 #include "components/sync/base/sync_prefs.h" 33 #include "components/sync/base/sync_prefs.h"
(...skipping 16 matching lines...) Expand all
49 #include "components/sync/engine/sync_manager_factory.h" 50 #include "components/sync/engine/sync_manager_factory.h"
50 #include "components/sync/js/sync_js_controller.h" 51 #include "components/sync/js/sync_js_controller.h"
51 #include "components/sync/model/model_type_store.h" 52 #include "components/sync/model/model_type_store.h"
52 #include "components/sync/syncable/user_share.h" 53 #include "components/sync/syncable/user_share.h"
53 #include "components/version_info/version_info.h" 54 #include "components/version_info/version_info.h"
54 #include "google_apis/gaia/google_service_auth_error.h" 55 #include "google_apis/gaia/google_service_auth_error.h"
55 #include "google_apis/gaia/oauth2_token_service.h" 56 #include "google_apis/gaia/oauth2_token_service.h"
56 #include "net/base/backoff_entry.h" 57 #include "net/base/backoff_entry.h"
57 #include "url/gurl.h" 58 #include "url/gurl.h"
58 59
59 class Profile;
60 class ProfileOAuth2TokenService; 60 class ProfileOAuth2TokenService;
61 class SigninManagerWrapper; 61 class SigninManagerWrapper;
62 62
63 namespace sync_sessions { 63 namespace sync_sessions {
64 class FaviconCache; 64 class FaviconCache;
65 class OpenTabsUIDelegate; 65 class OpenTabsUIDelegate;
66 class SessionsSyncManager; 66 class SessionsSyncManager;
67 } // namespace sync_sessions 67 } // namespace sync_sessions
68 68
69 namespace syncer { 69 namespace syncer {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 std::unique_ptr<syncer::SyncClient> sync_client; 233 std::unique_ptr<syncer::SyncClient> sync_client;
234 std::unique_ptr<SigninManagerWrapper> signin_wrapper; 234 std::unique_ptr<SigninManagerWrapper> signin_wrapper;
235 ProfileOAuth2TokenService* oauth2_token_service = nullptr; 235 ProfileOAuth2TokenService* oauth2_token_service = nullptr;
236 GaiaCookieManagerService* gaia_cookie_manager_service = nullptr; 236 GaiaCookieManagerService* gaia_cookie_manager_service = nullptr;
237 StartBehavior start_behavior = MANUAL_START; 237 StartBehavior start_behavior = MANUAL_START;
238 syncer::NetworkTimeUpdateCallback network_time_update_callback; 238 syncer::NetworkTimeUpdateCallback network_time_update_callback;
239 base::FilePath base_directory; 239 base::FilePath base_directory;
240 scoped_refptr<net::URLRequestContextGetter> url_request_context; 240 scoped_refptr<net::URLRequestContextGetter> url_request_context;
241 std::string debug_identifier; 241 std::string debug_identifier;
242 version_info::Channel channel = version_info::Channel::UNKNOWN; 242 version_info::Channel channel = version_info::Channel::UNKNOWN;
243 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner;
244 243
245 private: 244 private:
246 DISALLOW_COPY_AND_ASSIGN(InitParams); 245 DISALLOW_COPY_AND_ASSIGN(InitParams);
247 }; 246 };
248 247
249 explicit ProfileSyncService(InitParams init_params); 248 explicit ProfileSyncService(InitParams init_params);
250 249
251 ~ProfileSyncService() override; 250 ~ProfileSyncService() override;
252 251
253 // Initializes the object. This must be called at most once, and 252 // Initializes the object. This must be called at most once, and
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 544
546 // Returns a serialized NigoriKey proto generated from the bootstrap token in 545 // Returns a serialized NigoriKey proto generated from the bootstrap token in
547 // SyncPrefs. Will return the empty string if no bootstrap token exists. 546 // SyncPrefs. Will return the empty string if no bootstrap token exists.
548 std::string GetCustomPassphraseKey() const; 547 std::string GetCustomPassphraseKey() const;
549 548
550 // Set the provider for whether sync is currently allowed by the platform. 549 // Set the provider for whether sync is currently allowed by the platform.
551 void SetPlatformSyncAllowedProvider( 550 void SetPlatformSyncAllowedProvider(
552 const PlatformSyncAllowedProvider& platform_sync_allowed_provider); 551 const PlatformSyncAllowedProvider& platform_sync_allowed_provider);
553 552
554 // Returns a function for |type| that will create a ModelTypeStore that shares 553 // Returns a function for |type| that will create a ModelTypeStore that shares
555 // the sync LevelDB backend. 554 // the sync LevelDB backend. |base_path| should be set to profile path.
556 syncer::ModelTypeStoreFactory GetModelTypeStoreFactory( 555 // |sequenced_worker_pool| is obtained from content::BrowserThread or
557 syncer::ModelType type); 556 // web::WebThread depending on platform.
557 static syncer::ModelTypeStoreFactory GetModelTypeStoreFactory(
558 syncer::ModelType type,
559 const base::FilePath& base_path,
560 base::SequencedWorkerPool* sequenced_worker_pool);
558 561
559 // Needed to test whether the directory is deleted properly. 562 // Needed to test whether the directory is deleted properly.
560 base::FilePath GetDirectoryPathForTest() const; 563 base::FilePath GetDirectoryPathForTest() const;
561 564
562 // Sometimes we need to wait for tasks on the sync thread in tests. 565 // Sometimes we need to wait for tasks on the sync thread in tests.
563 base::MessageLoop* GetSyncLoopForTest() const; 566 base::MessageLoop* GetSyncLoopForTest() const;
564 567
565 // Some tests rely on injecting calls to the encryption observer. 568 // Some tests rely on injecting calls to the encryption observer.
566 syncer::SyncEncryptionHandler::Observer* GetEncryptionObserverForTest() const; 569 syncer::SyncEncryptionHandler::Observer* GetEncryptionObserverForTest() const;
567 570
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 // OnConfigureStart has not yet been called, and is reset to zero once 755 // OnConfigureStart has not yet been called, and is reset to zero once
753 // OnConfigureDone is called. 756 // OnConfigureDone is called.
754 base::Time sync_configure_start_time_; 757 base::Time sync_configure_start_time_;
755 758
756 // Callback to update the network time; used for initializing the engine. 759 // Callback to update the network time; used for initializing the engine.
757 syncer::NetworkTimeUpdateCallback network_time_update_callback_; 760 syncer::NetworkTimeUpdateCallback network_time_update_callback_;
758 761
759 // The request context in which sync should operate. 762 // The request context in which sync should operate.
760 scoped_refptr<net::URLRequestContextGetter> url_request_context_; 763 scoped_refptr<net::URLRequestContextGetter> url_request_context_;
761 764
762 // The task runner to use for blocking IO operations.
763 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
764
765 // Indicates if this is the first time sync is being configured. This value 765 // Indicates if this is the first time sync is being configured. This value
766 // is equal to !IsFirstSetupComplete() at the time of OnEngineInitialized(). 766 // is equal to !IsFirstSetupComplete() at the time of OnEngineInitialized().
767 bool is_first_time_sync_configure_; 767 bool is_first_time_sync_configure_;
768 768
769 // Number of UIs currently configuring the Sync service. When this number 769 // Number of UIs currently configuring the Sync service. When this number
770 // is decremented back to zero, Sync setup is marked no longer in progress. 770 // is decremented back to zero, Sync setup is marked no longer in progress.
771 int outstanding_setup_in_progress_handles_ = 0; 771 int outstanding_setup_in_progress_handles_ = 0;
772 772
773 // List of available data type controllers. 773 // List of available data type controllers.
774 syncer::DataTypeController::TypeMap data_type_controllers_; 774 syncer::DataTypeController::TypeMap data_type_controllers_;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 base::WeakPtrFactory<ProfileSyncService> weak_factory_; 888 base::WeakPtrFactory<ProfileSyncService> weak_factory_;
889 889
890 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 890 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
891 }; 891 };
892 892
893 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error); 893 bool ShouldShowActionOnUI(const syncer::SyncProtocolError& error);
894 894
895 } // namespace browser_sync 895 } // namespace browser_sync
896 896
897 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 897 #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_test_util.cc ('k') | components/browser_sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698