OLD | NEW |
1 // Copyright (c) 2006-2008 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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
(...skipping 12 matching lines...) Expand all Loading... |
24 #include "chrome/common/notification_observer.h" | 24 #include "chrome/common/notification_observer.h" |
25 #include "chrome/common/notification_registrar.h" | 25 #include "chrome/common/notification_registrar.h" |
26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
27 | 27 |
28 class NotificationDetails; | 28 class NotificationDetails; |
29 class NotificationSource; | 29 class NotificationSource; |
30 class NotificationType; | 30 class NotificationType; |
31 class Profile; | 31 class Profile; |
32 class ProfileSyncFactory; | 32 class ProfileSyncFactory; |
33 | 33 |
34 namespace chrome_common_net { | |
35 class NetworkChangeNotifierThread; | |
36 } | |
37 | |
38 // Various UI components such as the New Tab page can be driven by observing | 34 // Various UI components such as the New Tab page can be driven by observing |
39 // the ProfileSyncService through this interface. | 35 // the ProfileSyncService through this interface. |
40 class ProfileSyncServiceObserver { | 36 class ProfileSyncServiceObserver { |
41 public: | 37 public: |
42 // When one of the following events occurs, OnStateChanged() is called. | 38 // When one of the following events occurs, OnStateChanged() is called. |
43 // Observers should query the service to determine what happened. | 39 // Observers should query the service to determine what happened. |
44 // - We initialized successfully. | 40 // - We initialized successfully. |
45 // - There was an authentication error and the user needs to reauthenticate. | 41 // - There was an authentication error and the user needs to reauthenticate. |
46 // - The sync servers are unavailable at this time. | 42 // - The sync servers are unavailable at this time. |
47 // - Credentials are now in flight for authentication. | 43 // - Credentials are now in flight for authentication. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 MAX_SYNC_EVENT_CODE | 118 MAX_SYNC_EVENT_CODE |
123 }; | 119 }; |
124 | 120 |
125 // Default sync server URL. | 121 // Default sync server URL. |
126 static const char* kSyncServerUrl; | 122 static const char* kSyncServerUrl; |
127 // Sync server URL for dev channel users | 123 // Sync server URL for dev channel users |
128 static const char* kDevServerUrl; | 124 static const char* kDevServerUrl; |
129 | 125 |
130 ProfileSyncService(ProfileSyncFactory* factory_, | 126 ProfileSyncService(ProfileSyncFactory* factory_, |
131 Profile* profile, | 127 Profile* profile, |
132 chrome_common_net::NetworkChangeNotifierThread* | |
133 network_change_notifier_thread, | |
134 bool bootstrap_sync_authentication); | 128 bool bootstrap_sync_authentication); |
135 virtual ~ProfileSyncService(); | 129 virtual ~ProfileSyncService(); |
136 | 130 |
137 // Initializes the object. This should be called every time an object of this | 131 // Initializes the object. This should be called every time an object of this |
138 // class is constructed. | 132 // class is constructed. |
139 void Initialize(); | 133 void Initialize(); |
140 | 134 |
141 // Registers a data type controller with the sync service. This | 135 // Registers a data type controller with the sync service. This |
142 // makes the data type controller available for use, it does not | 136 // makes the data type controller available for use, it does not |
143 // enable or activate the synchronization of the data type (see | 137 // enable or activate the synchronization of the data type (see |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 372 |
379 // Time at which error UI is presented for the new tab page. | 373 // Time at which error UI is presented for the new tab page. |
380 base::TimeTicks auth_error_time_; | 374 base::TimeTicks auth_error_time_; |
381 | 375 |
382 // Factory used to create various dependent objects. | 376 // Factory used to create various dependent objects. |
383 ProfileSyncFactory* factory_; | 377 ProfileSyncFactory* factory_; |
384 | 378 |
385 // The profile whose data we are synchronizing. | 379 // The profile whose data we are synchronizing. |
386 Profile* profile_; | 380 Profile* profile_; |
387 | 381 |
388 chrome_common_net::NetworkChangeNotifierThread* | |
389 network_change_notifier_thread_; | |
390 | |
391 // True if the profile sync service should attempt to use an LSID | 382 // True if the profile sync service should attempt to use an LSID |
392 // cookie for authentication. This is typically set to true in | 383 // cookie for authentication. This is typically set to true in |
393 // ChromiumOS since we want to use the system level authentication | 384 // ChromiumOS since we want to use the system level authentication |
394 // for sync. | 385 // for sync. |
395 bool bootstrap_sync_authentication_; | 386 bool bootstrap_sync_authentication_; |
396 | 387 |
397 // TODO(ncarter): Put this in a profile, once there is UI for it. | 388 // TODO(ncarter): Put this in a profile, once there is UI for it. |
398 // This specifies where to find the sync server. | 389 // This specifies where to find the sync server. |
399 GURL sync_service_url_; | 390 GURL sync_service_url_; |
400 | 391 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 441 |
451 NotificationRegistrar registrar_; | 442 NotificationRegistrar registrar_; |
452 | 443 |
453 ScopedRunnableMethodFactory<ProfileSyncService> | 444 ScopedRunnableMethodFactory<ProfileSyncService> |
454 scoped_runnable_method_factory_; | 445 scoped_runnable_method_factory_; |
455 | 446 |
456 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 447 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
457 }; | 448 }; |
458 | 449 |
459 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 450 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |