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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.h

Issue 9235040: [Sync] Handle errors during first sync gracefully. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload before commit. Created 8 years, 11 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_GLUE_SYNC_BACKEND_HOST_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // 57 //
58 // |js_backend| is what about:sync interacts with; it's different 58 // |js_backend| is what about:sync interacts with; it's different
59 // from the 'Backend' in 'OnBackendInitialized' (unfortunately). It 59 // from the 'Backend' in 'OnBackendInitialized' (unfortunately). It
60 // is initialized only if |success| is true. 60 // is initialized only if |success| is true.
61 virtual void OnBackendInitialized( 61 virtual void OnBackendInitialized(
62 const WeakHandle<JsBackend>& js_backend, bool success) = 0; 62 const WeakHandle<JsBackend>& js_backend, bool success) = 0;
63 63
64 // The backend queried the server recently and received some updates. 64 // The backend queried the server recently and received some updates.
65 virtual void OnSyncCycleCompleted() = 0; 65 virtual void OnSyncCycleCompleted() = 0;
66 66
67 // Configure ran into some kind of error. But it is scheduled to be
68 // retried.
69 virtual void OnSyncConfigureRetry() = 0;
70
67 // The backend encountered an authentication problem and requests new 71 // The backend encountered an authentication problem and requests new
68 // credentials to be provided. See SyncBackendHost::Authenticate for details. 72 // credentials to be provided. See SyncBackendHost::Authenticate for details.
69 virtual void OnAuthError() = 0; 73 virtual void OnAuthError() = 0;
70 74
71 // We are no longer permitted to communicate with the server. Sync should 75 // We are no longer permitted to communicate with the server. Sync should
72 // be disabled and state cleaned up at once. 76 // be disabled and state cleaned up at once.
73 virtual void OnStopSyncingPermanently() = 0; 77 virtual void OnStopSyncingPermanently() = 0;
74 78
75 // Called to handle success/failure of clearing server data 79 // Called to handle success/failure of clearing server data
76 virtual void OnClearServerDataSucceeded() = 0; 80 virtual void OnClearServerDataSucceeded() = 0;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 197
194 // Changes the set of data types that are currently being synced. 198 // Changes the set of data types that are currently being synced.
195 // The ready_task will be run when configuration is done with the 199 // The ready_task will be run when configuration is done with the
196 // set of all types that failed configuration (i.e., if its argument 200 // set of all types that failed configuration (i.e., if its argument
197 // is non-empty, then an error was encountered). 201 // is non-empty, then an error was encountered).
198 virtual void ConfigureDataTypes( 202 virtual void ConfigureDataTypes(
199 syncable::ModelTypeSet types_to_add, 203 syncable::ModelTypeSet types_to_add,
200 syncable::ModelTypeSet types_to_remove, 204 syncable::ModelTypeSet types_to_remove,
201 sync_api::ConfigureReason reason, 205 sync_api::ConfigureReason reason,
202 base::Callback<void(syncable::ModelTypeSet)> ready_task, 206 base::Callback<void(syncable::ModelTypeSet)> ready_task,
207 base::Callback<void()> retry_callback,
203 bool enable_nigori); 208 bool enable_nigori);
204 209
205 // Makes an asynchronous call to syncer to switch to config mode. When done 210 // Makes an asynchronous call to syncer to switch to config mode. When done
206 // syncer will call us back on FinishConfigureDataTypes. 211 // syncer will call us back on FinishConfigureDataTypes.
207 virtual void StartConfiguration(const base::Closure& callback); 212 virtual void StartConfiguration(const base::Closure& callback);
208 213
209 // Turns on encryption of all present and future sync data. 214 // Turns on encryption of all present and future sync data.
210 virtual void EnableEncryptEverything(); 215 virtual void EnableEncryptEverything();
211 216
212 // Activates change processing for the given data type. This must 217 // Activates change processing for the given data type. This must
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 334
330 struct PendingConfigureDataTypesState { 335 struct PendingConfigureDataTypesState {
331 PendingConfigureDataTypesState(); 336 PendingConfigureDataTypesState();
332 ~PendingConfigureDataTypesState(); 337 ~PendingConfigureDataTypesState();
333 338
334 // The ready_task will be run when configuration is done with the 339 // The ready_task will be run when configuration is done with the
335 // set of all types that failed configuration (i.e., if its 340 // set of all types that failed configuration (i.e., if its
336 // argument is non-empty, then an error was encountered). 341 // argument is non-empty, then an error was encountered).
337 base::Callback<void(syncable::ModelTypeSet)> ready_task; 342 base::Callback<void(syncable::ModelTypeSet)> ready_task;
338 343
344 // The retry callback will be run when the download failed due to a
345 // transient error. This is to notify DTM so it can apropriately inform
346 // the UI. Note: The retry_callback will be run only once and after
347 // that we will not notify DTM until the sync is successful or in a
348 // permanent error state.
349 base::Callback<void()> retry_callback;
350
339 // The set of types that we are waiting to be initially synced in a 351 // The set of types that we are waiting to be initially synced in a
340 // configuration cycle. 352 // configuration cycle.
341 syncable::ModelTypeSet types_to_add; 353 syncable::ModelTypeSet types_to_add;
342 354
343 // Additional details about which types were added. 355 // Additional details about which types were added.
344 syncable::ModelTypeSet added_types; 356 syncable::ModelTypeSet added_types;
345 sync_api::ConfigureReason reason; 357 sync_api::ConfigureReason reason;
358 bool retry_in_progress;
346 }; 359 };
347 360
348 // Checks if we have received a notice to turn on experimental datatypes 361 // Checks if we have received a notice to turn on experimental datatypes
349 // (via the nigori node) and informs the frontend if that is the case. 362 // (via the nigori node) and informs the frontend if that is the case.
350 // Note: it is illegal to call this before the backend is initialized. 363 // Note: it is illegal to call this before the backend is initialized.
351 void AddExperimentalTypes(); 364 void AddExperimentalTypes();
352 365
366 // Downloading of nigori failed and will be retried.
367 virtual void OnNigoriDownloadRetry();
368
353 // InitializationComplete passes through the SyncBackendHost to forward 369 // InitializationComplete passes through the SyncBackendHost to forward
354 // on to |frontend_|, and so that tests can intercept here if they need to 370 // on to |frontend_|, and so that tests can intercept here if they need to
355 // set up initial conditions. 371 // set up initial conditions.
356 virtual void HandleInitializationCompletedOnFrontendLoop( 372 virtual void HandleInitializationCompletedOnFrontendLoop(
357 const WeakHandle<JsBackend>& js_backend, 373 const WeakHandle<JsBackend>& js_backend,
358 bool success); 374 bool success);
359 375
360 // Helpers to persist a token that can be used to bootstrap sync encryption 376 // Helpers to persist a token that can be used to bootstrap sync encryption
361 // across browser restart to avoid requiring the user to re-enter their 377 // across browser restart to avoid requiring the user to re-enter their
362 // passphrase. |token| must be valid UTF-8 as we use the PrefService for 378 // passphrase. |token| must be valid UTF-8 as we use the PrefService for
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 488
473 // UI-thread cache of the last SyncSessionSnapshot received from syncapi. 489 // UI-thread cache of the last SyncSessionSnapshot received from syncapi.
474 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_; 490 scoped_ptr<sessions::SyncSessionSnapshot> last_snapshot_;
475 491
476 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); 492 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost);
477 }; 493 };
478 494
479 } // namespace browser_sync 495 } // namespace browser_sync
480 496
481 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ 497 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/data_type_manager_impl_unittest.cc ('k') | chrome/browser/sync/glue/sync_backend_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698