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

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

Issue 428143002: Sync: Add a SyncTypePreferenceProvider interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 6 years, 4 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) 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 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 <set>
8 #include <string> 9 #include <string>
9 #include <utility> 10 #include <utility>
10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
(...skipping 29 matching lines...) Expand all
50 #include "sync/internal_api/public/util/experiments.h" 50 #include "sync/internal_api/public/util/experiments.h"
51 #include "sync/internal_api/public/util/unrecoverable_error_handler.h" 51 #include "sync/internal_api/public/util/unrecoverable_error_handler.h"
52 #include "sync/js/sync_js_controller.h" 52 #include "sync/js/sync_js_controller.h"
53 #include "url/gurl.h" 53 #include "url/gurl.h"
54 54
55 class Profile; 55 class Profile;
56 class ProfileOAuth2TokenService; 56 class ProfileOAuth2TokenService;
57 class ProfileSyncComponentsFactory; 57 class ProfileSyncComponentsFactory;
58 class SupervisedUserSigninManagerWrapper; 58 class SupervisedUserSigninManagerWrapper;
59 class SyncErrorController; 59 class SyncErrorController;
60 class SyncTypePreferenceProvider;
60 61
61 namespace base { 62 namespace base {
62 class CommandLine; 63 class CommandLine;
63 }; 64 };
64 65
65 namespace browser_sync { 66 namespace browser_sync {
66 class BackendMigrator; 67 class BackendMigrator;
67 class DeviceInfo; 68 class DeviceInfo;
68 class FaviconCache; 69 class FaviconCache;
69 class JsController; 70 class JsController;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 ProfileSyncServiceBase::Observer* observer) const OVERRIDE; 295 ProfileSyncServiceBase::Observer* observer) const OVERRIDE;
295 296
296 297
297 void AddProtocolEventObserver(browser_sync::ProtocolEventObserver* observer); 298 void AddProtocolEventObserver(browser_sync::ProtocolEventObserver* observer);
298 void RemoveProtocolEventObserver( 299 void RemoveProtocolEventObserver(
299 browser_sync::ProtocolEventObserver* observer); 300 browser_sync::ProtocolEventObserver* observer);
300 301
301 void AddTypeDebugInfoObserver(syncer::TypeDebugInfoObserver* observer); 302 void AddTypeDebugInfoObserver(syncer::TypeDebugInfoObserver* observer);
302 void RemoveTypeDebugInfoObserver(syncer::TypeDebugInfoObserver* observer); 303 void RemoveTypeDebugInfoObserver(syncer::TypeDebugInfoObserver* observer);
303 304
305 // Add a sync type preference provider. Each provider may only be added once.
306 void AddPreferenceProvider(SyncTypePreferenceProvider* provider);
307 // Remove a sync type preference provider. May only be called for providers
308 // that have been added. Providers must not remove themselves while being
309 // called back.
310 void RemovePreferenceProvider(SyncTypePreferenceProvider* provider);
311 // Check whether a given sync type preference provider has been added.
312 bool HasPreferenceProvider(SyncTypePreferenceProvider* provider) const;
313
304 // Asynchronously fetches base::Value representations of all sync nodes and 314 // Asynchronously fetches base::Value representations of all sync nodes and
305 // returns them to the specified callback on this thread. 315 // returns them to the specified callback on this thread.
306 // 316 //
307 // These requests can live a long time and return when you least expect it. 317 // These requests can live a long time and return when you least expect it.
308 // For safety, the callback should be bound to some sort of WeakPtr<> or 318 // For safety, the callback should be bound to some sort of WeakPtr<> or
309 // scoped_refptr<>. 319 // scoped_refptr<>.
310 void GetAllNodes( 320 void GetAllNodes(
311 const base::Callback<void(scoped_ptr<base::ListValue>)>& callback); 321 const base::Callback<void(scoped_ptr<base::ListValue>)>& callback);
312 322
313 void RegisterAuthNotifications(); 323 void RegisterAuthNotifications();
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 void RegisterNewDataType(syncer::ModelType data_type); 918 void RegisterNewDataType(syncer::ModelType data_type);
909 919
910 // Reconfigures the data type manager with the latest enabled types. 920 // Reconfigures the data type manager with the latest enabled types.
911 // Note: Does not initialize the backend if it is not already initialized. 921 // Note: Does not initialize the backend if it is not already initialized.
912 // This function needs to be called only after sync has been initialized 922 // This function needs to be called only after sync has been initialized
913 // (i.e.,only for reconfigurations). The reason we don't initialize the 923 // (i.e.,only for reconfigurations). The reason we don't initialize the
914 // backend is because if we had encountered an unrecoverable error we don't 924 // backend is because if we had encountered an unrecoverable error we don't
915 // want to startup once more. 925 // want to startup once more.
916 virtual void ReconfigureDatatypeManager(); 926 virtual void ReconfigureDatatypeManager();
917 927
928 // Collects preferred sync data types from |preference_providers_|.
929 syncer::ModelTypeSet GetDataTypesFromPreferenceProviders() const;
930
918 // Called when the user changes the sync configuration, to update the UMA 931 // Called when the user changes the sync configuration, to update the UMA
919 // stats. 932 // stats.
920 void UpdateSelectedTypesHistogram( 933 void UpdateSelectedTypesHistogram(
921 bool sync_everything, 934 bool sync_everything,
922 const syncer::ModelTypeSet chosen_types) const; 935 const syncer::ModelTypeSet chosen_types) const;
923 936
924 #if defined(OS_CHROMEOS) 937 #if defined(OS_CHROMEOS)
925 // Refresh spare sync bootstrap token for re-enabling the sync service. 938 // Refresh spare sync bootstrap token for re-enabling the sync service.
926 // Called on successful sign-in notifications. 939 // Called on successful sign-in notifications.
927 void RefreshSpareBootstrapToken(const std::string& passphrase); 940 void RefreshSpareBootstrapToken(const std::string& passphrase);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 // Manages the start and stop of the directory data types. 1025 // Manages the start and stop of the directory data types.
1013 scoped_ptr<sync_driver::DataTypeManager> directory_data_type_manager_; 1026 scoped_ptr<sync_driver::DataTypeManager> directory_data_type_manager_;
1014 1027
1015 // Manager for the non-blocking data types. 1028 // Manager for the non-blocking data types.
1016 sync_driver::NonBlockingDataTypeManager non_blocking_data_type_manager_; 1029 sync_driver::NonBlockingDataTypeManager non_blocking_data_type_manager_;
1017 1030
1018 ObserverList<ProfileSyncServiceBase::Observer> observers_; 1031 ObserverList<ProfileSyncServiceBase::Observer> observers_;
1019 ObserverList<browser_sync::ProtocolEventObserver> protocol_event_observers_; 1032 ObserverList<browser_sync::ProtocolEventObserver> protocol_event_observers_;
1020 ObserverList<syncer::TypeDebugInfoObserver> type_debug_info_observers_; 1033 ObserverList<syncer::TypeDebugInfoObserver> type_debug_info_observers_;
1021 1034
1035 std::set<SyncTypePreferenceProvider*> preference_providers_;
1036
1022 syncer::SyncJsController sync_js_controller_; 1037 syncer::SyncJsController sync_js_controller_;
1023 1038
1024 // This allows us to gracefully handle an ABORTED return code from the 1039 // This allows us to gracefully handle an ABORTED return code from the
1025 // DataTypeManager in the event that the server informed us to cease and 1040 // DataTypeManager in the event that the server informed us to cease and
1026 // desist syncing immediately. 1041 // desist syncing immediately.
1027 bool expect_sync_configuration_aborted_; 1042 bool expect_sync_configuration_aborted_;
1028 1043
1029 // Sometimes we need to temporarily hold on to a passphrase because we don't 1044 // Sometimes we need to temporarily hold on to a passphrase because we don't
1030 // yet have a backend to send it to. This happens during initialization as 1045 // yet have a backend to send it to. This happens during initialization as
1031 // we don't StartUp until we have a valid token, which happens after valid 1046 // we don't StartUp until we have a valid token, which happens after valid
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 scoped_ptr<base::Time> last_backup_time_; 1147 scoped_ptr<base::Time> last_backup_time_;
1133 1148
1134 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); 1149 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService);
1135 }; 1150 };
1136 1151
1137 bool ShouldShowActionOnUI( 1152 bool ShouldShowActionOnUI(
1138 const syncer::SyncProtocolError& error); 1153 const syncer::SyncProtocolError& error);
1139 1154
1140 1155
1141 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ 1156 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/supervised_user/supervised_user_service_factory.cc ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698