OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/sync/glue/sync_backend_host_core.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_core.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "chrome/browser/sync/glue/invalidation_adapter.h" | 11 #include "chrome/browser/sync/glue/invalidation_adapter.h" |
12 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" | 12 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" |
13 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 13 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
14 #include "chrome/common/chrome_version_info.h" | |
15 #include "components/invalidation/public/invalidation_util.h" | 14 #include "components/invalidation/public/invalidation_util.h" |
16 #include "components/invalidation/public/object_id_invalidation_map.h" | 15 #include "components/invalidation/public/object_id_invalidation_map.h" |
17 #include "sync/internal_api/public/events/protocol_event.h" | 16 #include "sync/internal_api/public/events/protocol_event.h" |
18 #include "sync/internal_api/public/http_post_provider_factory.h" | 17 #include "sync/internal_api/public/http_post_provider_factory.h" |
19 #include "sync/internal_api/public/internal_components_factory.h" | 18 #include "sync/internal_api/public/internal_components_factory.h" |
20 #include "sync/internal_api/public/sessions/commit_counters.h" | 19 #include "sync/internal_api/public/sessions/commit_counters.h" |
21 #include "sync/internal_api/public/sessions/status_counters.h" | 20 #include "sync/internal_api/public/sessions/status_counters.h" |
22 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 21 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
23 #include "sync/internal_api/public/sessions/update_counters.h" | 22 #include "sync/internal_api/public/sessions/update_counters.h" |
24 #include "sync/internal_api/public/sync_context_proxy.h" | 23 #include "sync/internal_api/public/sync_context_proxy.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } | 401 } |
403 | 402 |
404 void SyncBackendHostCore::DoInitialize( | 403 void SyncBackendHostCore::DoInitialize( |
405 scoped_ptr<DoInitializeOptions> options) { | 404 scoped_ptr<DoInitializeOptions> options) { |
406 DCHECK(!sync_loop_); | 405 DCHECK(!sync_loop_); |
407 sync_loop_ = options->sync_loop; | 406 sync_loop_ = options->sync_loop; |
408 DCHECK(sync_loop_); | 407 DCHECK(sync_loop_); |
409 | 408 |
410 // Finish initializing the HttpBridgeFactory. We do this here because | 409 // Finish initializing the HttpBridgeFactory. We do this here because |
411 // building the user agent may block on some platforms. | 410 // building the user agent may block on some platforms. |
412 chrome::VersionInfo version_info; | |
413 options->http_bridge_factory->Init( | 411 options->http_bridge_factory->Init( |
414 LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi(version_info)); | 412 LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi()); |
415 | 413 |
416 // Blow away the partial or corrupt sync data folder before doing any more | 414 // Blow away the partial or corrupt sync data folder before doing any more |
417 // initialization, if necessary. | 415 // initialization, if necessary. |
418 if (options->delete_sync_data_folder) { | 416 if (options->delete_sync_data_folder) { |
419 DeleteSyncDataFolder(); | 417 DeleteSyncDataFolder(); |
420 } | 418 } |
421 | 419 |
422 // Make sure that the directory exists before initializing the backend. | 420 // Make sure that the directory exists before initializing the backend. |
423 // If it already exists, this will do no harm. | 421 // If it already exists, this will do no harm. |
424 if (!base::CreateDirectory(sync_data_folder_path_)) { | 422 if (!base::CreateDirectory(sync_data_folder_path_)) { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 752 |
755 void SyncBackendHostCore::ClearServerDataDone( | 753 void SyncBackendHostCore::ClearServerDataDone( |
756 const base::Closure& frontend_callback) { | 754 const base::Closure& frontend_callback) { |
757 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); | 755 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); |
758 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, | 756 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, |
759 frontend_callback); | 757 frontend_callback); |
760 } | 758 } |
761 | 759 |
762 | 760 |
763 } // namespace browser_sync | 761 } // namespace browser_sync |
OLD | NEW |