OLD | NEW |
1 // Copyright (c) 2009 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 // This file defines the "sync API", an interface to the syncer | 5 // This file defines the "sync API", an interface to the syncer |
6 // backend that exposes (1) the core functionality of maintaining a consistent | 6 // backend that exposes (1) the core functionality of maintaining a consistent |
7 // local snapshot of a hierarchical object set; (2) a means to transactionally | 7 // local snapshot of a hierarchical object set; (2) a means to transactionally |
8 // access and modify those objects; (3) a means to control client/server | 8 // access and modify those objects; (3) a means to control client/server |
9 // synchronization tasks, namely: pushing local object modifications to a | 9 // synchronization tasks, namely: pushing local object modifications to a |
10 // server, pulling nonlocal object modifications from a server to this client, | 10 // server, pulling nonlocal object modifications from a server to this client, |
11 // and resolving conflicts that may arise between the two; and (4) an | 11 // and resolving conflicts that may arise between the two; and (4) an |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "googleurl/src/gurl.h" | 53 #include "googleurl/src/gurl.h" |
54 | 54 |
55 namespace browser_sync { | 55 namespace browser_sync { |
56 class ModelSafeWorkerRegistrar; | 56 class ModelSafeWorkerRegistrar; |
57 | 57 |
58 namespace sessions { | 58 namespace sessions { |
59 struct SyncSessionSnapshot; | 59 struct SyncSessionSnapshot; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 namespace chrome_common_net { | |
64 class NetworkChangeNotifierThread; | |
65 } | |
66 | |
67 // Forward declarations of internal class types so that sync API objects | 63 // Forward declarations of internal class types so that sync API objects |
68 // may have opaque pointers to these types. | 64 // may have opaque pointers to these types. |
69 namespace syncable { | 65 namespace syncable { |
70 class BaseTransaction; | 66 class BaseTransaction; |
71 class DirectoryManager; | 67 class DirectoryManager; |
72 class Entry; | 68 class Entry; |
73 class MutableEntry; | 69 class MutableEntry; |
74 class ReadTransaction; | 70 class ReadTransaction; |
75 class ScopedDirLookup; | 71 class ScopedDirLookup; |
76 class WriteTransaction; | 72 class WriteTransaction; |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 | 699 |
704 // Initialize the sync manager. |database_location| specifies the path of | 700 // Initialize the sync manager. |database_location| specifies the path of |
705 // the directory in which to locate a sqlite repository storing the syncer | 701 // the directory in which to locate a sqlite repository storing the syncer |
706 // backend state. Initialization will open the database, or create it if it | 702 // backend state. Initialization will open the database, or create it if it |
707 // does not already exist. Returns false on failure. | 703 // does not already exist. Returns false on failure. |
708 // |sync_server_and_path| and |sync_server_port| represent the Chrome sync | 704 // |sync_server_and_path| and |sync_server_port| represent the Chrome sync |
709 // server to use, and |use_ssl| specifies whether to communicate securely; | 705 // server to use, and |use_ssl| specifies whether to communicate securely; |
710 // the default is false. | 706 // the default is false. |
711 // |gaia_service_id| is the service id used for GAIA authentication. If it's | 707 // |gaia_service_id| is the service id used for GAIA authentication. If it's |
712 // null then default will be used. | 708 // null then default will be used. |
713 // |network_change_notifier_thread| (which we don't own) is the | |
714 // thread from which we get notifications regarding changes to the | |
715 // network state. | |
716 // |post_factory| will be owned internally and used to create | 709 // |post_factory| will be owned internally and used to create |
717 // instances of an HttpPostProvider. | 710 // instances of an HttpPostProvider. |
718 // |auth_post_factory| will be owned internally and used to create | 711 // |auth_post_factory| will be owned internally and used to create |
719 // instances of an HttpPostProvider for communicating with GAIA. | 712 // instances of an HttpPostProvider for communicating with GAIA. |
720 // TODO(timsteele): It seems like one factory should suffice, but for now to | 713 // TODO(timsteele): It seems like one factory should suffice, but for now to |
721 // avoid having to deal with threading issues since the auth code and syncer | 714 // avoid having to deal with threading issues since the auth code and syncer |
722 // code live on separate threads that run simultaneously, we just dedicate | 715 // code live on separate threads that run simultaneously, we just dedicate |
723 // one to each component. Long term we may want to reconsider the HttpBridge | 716 // one to each component. Long term we may want to reconsider the HttpBridge |
724 // API to take all the params in one chunk in a threadsafe manner.. which is | 717 // API to take all the params in one chunk in a threadsafe manner.. which is |
725 // still suboptimal as there will be high contention between the two threads | 718 // still suboptimal as there will be high contention between the two threads |
(...skipping 12 matching lines...) Expand all Loading... |
738 // | 731 // |
739 // |invalidate_xmpp_auth_token| makes it so that any auth token | 732 // |invalidate_xmpp_auth_token| makes it so that any auth token |
740 // used to log into XMPP is invalidated. This is used for testing | 733 // used to log into XMPP is invalidated. This is used for testing |
741 // code paths related to authentication failures for XMPP only. | 734 // code paths related to authentication failures for XMPP only. |
742 bool Init(const FilePath& database_location, | 735 bool Init(const FilePath& database_location, |
743 const char* sync_server_and_path, | 736 const char* sync_server_and_path, |
744 int sync_server_port, | 737 int sync_server_port, |
745 const char* gaia_service_id, | 738 const char* gaia_service_id, |
746 const char* gaia_source, | 739 const char* gaia_source, |
747 bool use_ssl, | 740 bool use_ssl, |
748 chrome_common_net::NetworkChangeNotifierThread* | |
749 network_change_notifier_thread, | |
750 HttpPostProviderFactory* post_factory, | 741 HttpPostProviderFactory* post_factory, |
751 HttpPostProviderFactory* auth_post_factory, | 742 HttpPostProviderFactory* auth_post_factory, |
752 browser_sync::ModelSafeWorkerRegistrar* registrar, | 743 browser_sync::ModelSafeWorkerRegistrar* registrar, |
753 bool attempt_last_user_authentication, | 744 bool attempt_last_user_authentication, |
754 bool invalidate_last_user_auth_token, | 745 bool invalidate_last_user_auth_token, |
755 bool invalidate_xmpp_auth_token, | 746 bool invalidate_xmpp_auth_token, |
756 const char* user_agent, | 747 const char* user_agent, |
757 const char* lsid, | 748 const char* lsid, |
758 browser_sync::NotificationMethod notification_method); | 749 browser_sync::NotificationMethod notification_method); |
759 | 750 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 // This allows actual HttpPostProvider subclass implementations to be | 901 // This allows actual HttpPostProvider subclass implementations to be |
911 // reference counted, which is useful if a particular implementation uses | 902 // reference counted, which is useful if a particular implementation uses |
912 // multiple threads to serve network requests. | 903 // multiple threads to serve network requests. |
913 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 904 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
914 virtual ~HttpPostProviderFactory() { } | 905 virtual ~HttpPostProviderFactory() { } |
915 }; | 906 }; |
916 | 907 |
917 } // namespace sync_api | 908 } // namespace sync_api |
918 | 909 |
919 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 910 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
OLD | NEW |