OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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, |
(...skipping 25 matching lines...) Expand all Loading... |
36 // children of a node can be enumerated in the order of their position. | 36 // children of a node can be enumerated in the order of their position. |
37 | 37 |
38 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 38 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
39 #define CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 39 #define CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
40 #pragma once | 40 #pragma once |
41 | 41 |
42 #include <string> | 42 #include <string> |
43 #include <vector> | 43 #include <vector> |
44 | 44 |
45 #include "base/basictypes.h" | 45 #include "base/basictypes.h" |
| 46 #include "base/callback.h" |
46 #include "base/gtest_prod_util.h" | 47 #include "base/gtest_prod_util.h" |
47 #include "base/memory/scoped_ptr.h" | 48 #include "base/memory/scoped_ptr.h" |
48 #include "build/build_config.h" | 49 #include "build/build_config.h" |
49 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 50 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
50 #include "chrome/browser/sync/syncable/autofill_migration.h" | 51 #include "chrome/browser/sync/syncable/autofill_migration.h" |
51 #include "chrome/browser/sync/syncable/model_type.h" | 52 #include "chrome/browser/sync/syncable/model_type.h" |
52 #include "chrome/browser/sync/util/cryptographer.h" | 53 #include "chrome/browser/sync/util/cryptographer.h" |
53 #include "chrome/common/net/gaia/google_service_auth_error.h" | 54 #include "chrome/common/net/gaia/google_service_auth_error.h" |
54 #include "googleurl/src/gurl.h" | 55 #include "googleurl/src/gurl.h" |
55 | 56 |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 virtual void OnClearServerDataFailed() = 0; | 822 virtual void OnClearServerDataFailed() = 0; |
822 | 823 |
823 // Called after we finish encrypting all appropriate datatypes. | 824 // Called after we finish encrypting all appropriate datatypes. |
824 virtual void OnEncryptionComplete( | 825 virtual void OnEncryptionComplete( |
825 const syncable::ModelTypeSet& encrypted_types) = 0; | 826 const syncable::ModelTypeSet& encrypted_types) = 0; |
826 | 827 |
827 protected: | 828 protected: |
828 virtual ~Observer(); | 829 virtual ~Observer(); |
829 }; | 830 }; |
830 | 831 |
| 832 typedef Callback0::Type ModeChangeCallback; |
| 833 |
831 // Create an uninitialized SyncManager. Callers must Init() before using. | 834 // Create an uninitialized SyncManager. Callers must Init() before using. |
832 SyncManager(); | 835 SyncManager(); |
833 virtual ~SyncManager(); | 836 virtual ~SyncManager(); |
834 | 837 |
835 // Initialize the sync manager. |database_location| specifies the path of | 838 // Initialize the sync manager. |database_location| specifies the path of |
836 // the directory in which to locate a sqlite repository storing the syncer | 839 // the directory in which to locate a sqlite repository storing the syncer |
837 // backend state. Initialization will open the database, or create it if it | 840 // backend state. Initialization will open the database, or create it if it |
838 // does not already exist. Returns false on failure. | 841 // does not already exist. Returns false on failure. |
839 // |sync_server_and_path| and |sync_server_port| represent the Chrome sync | 842 // |sync_server_and_path| and |sync_server_port| represent the Chrome sync |
840 // server to use, and |use_ssl| specifies whether to communicate securely; | 843 // server to use, and |use_ssl| specifies whether to communicate securely; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 // TODO(tim): Deprecated. | 921 // TODO(tim): Deprecated. |
919 bool RequestPause(); | 922 bool RequestPause(); |
920 | 923 |
921 // Requests the syncer thread to resume. The observer's OnResume | 924 // Requests the syncer thread to resume. The observer's OnResume |
922 // method will be called when the syncer thread is resumed. Returns | 925 // method will be called when the syncer thread is resumed. Returns |
923 // false if the syncer thread can not be resumed (e.g. if it is not | 926 // false if the syncer thread can not be resumed (e.g. if it is not |
924 // paused). | 927 // paused). |
925 // TODO(tim): Deprecated. | 928 // TODO(tim): Deprecated. |
926 bool RequestResume(); | 929 bool RequestResume(); |
927 | 930 |
| 931 // Puts the SyncerThread into a mode where no normal nudge or poll traffic |
| 932 // will occur, but calls to RequestConfig will be supported. If |callback| |
| 933 // is provided, it will be invoked (from the internal SyncerThread) when |
| 934 // the thread has changed to configuration mode. |
| 935 void StartConfigurationMode(ModeChangeCallback* callback); |
| 936 |
928 // For the new SyncerThread impl, this switches the mode of operation to | 937 // For the new SyncerThread impl, this switches the mode of operation to |
929 // CONFIGURATION_MODE and schedules a config task to fetch updates for | 938 // CONFIGURATION_MODE and schedules a config task to fetch updates for |
930 // |types|. It is an error to call this with legacy SyncerThread in use. | 939 // |types|. It is an error to call this with legacy SyncerThread in use. |
931 void RequestConfig(const syncable::ModelTypeBitSet& types); | 940 void RequestConfig(const syncable::ModelTypeBitSet& types); |
932 | 941 |
933 // Request a nudge of the syncer, which will cause the syncer thread | 942 // Request a nudge of the syncer, which will cause the syncer thread |
934 // to run at the next available opportunity. | 943 // to run at the next available opportunity. |
935 void RequestNudge(); | 944 void RequestNudge(); |
936 | 945 |
937 // Request a clearing of all data on the server | 946 // Request a clearing of all data on the server |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 // This allows actual HttpPostProvider subclass implementations to be | 1098 // This allows actual HttpPostProvider subclass implementations to be |
1090 // reference counted, which is useful if a particular implementation uses | 1099 // reference counted, which is useful if a particular implementation uses |
1091 // multiple threads to serve network requests. | 1100 // multiple threads to serve network requests. |
1092 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 1101 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
1093 virtual ~HttpPostProviderFactory() { } | 1102 virtual ~HttpPostProviderFactory() { } |
1094 }; | 1103 }; |
1095 | 1104 |
1096 } // namespace sync_api | 1105 } // namespace sync_api |
1097 | 1106 |
1098 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 1107 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
OLD | NEW |