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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host_core.cc

Issue 594643003: Device info datatype should be moved to components/sync_driver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed CR feedback Created 6 years, 3 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
OLDNEW
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/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/sync/glue/device_info.h"
10 #include "chrome/browser/sync/glue/invalidation_adapter.h" 9 #include "chrome/browser/sync/glue/invalidation_adapter.h"
10 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h"
11 #include "chrome/browser/sync/glue/sync_backend_registrar.h" 11 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
12 #include "chrome/common/chrome_version_info.h" 12 #include "chrome/common/chrome_version_info.h"
13 #include "components/invalidation/invalidation_util.h" 13 #include "components/invalidation/invalidation_util.h"
14 #include "components/invalidation/object_id_invalidation_map.h" 14 #include "components/invalidation/object_id_invalidation_map.h"
15 #include "sync/internal_api/public/events/protocol_event.h" 15 #include "sync/internal_api/public/events/protocol_event.h"
16 #include "sync/internal_api/public/http_post_provider_factory.h" 16 #include "sync/internal_api/public/http_post_provider_factory.h"
17 #include "sync/internal_api/public/internal_components_factory.h" 17 #include "sync/internal_api/public/internal_components_factory.h"
18 #include "sync/internal_api/public/sessions/commit_counters.h" 18 #include "sync/internal_api/public/sessions/commit_counters.h"
19 #include "sync/internal_api/public/sessions/status_counters.h" 19 #include "sync/internal_api/public/sessions/status_counters.h"
20 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 20 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 void SyncBackendHostCore::DoInitialize( 398 void SyncBackendHostCore::DoInitialize(
399 scoped_ptr<DoInitializeOptions> options) { 399 scoped_ptr<DoInitializeOptions> options) {
400 DCHECK(!sync_loop_); 400 DCHECK(!sync_loop_);
401 sync_loop_ = options->sync_loop; 401 sync_loop_ = options->sync_loop;
402 DCHECK(sync_loop_); 402 DCHECK(sync_loop_);
403 403
404 // Finish initializing the HttpBridgeFactory. We do this here because 404 // Finish initializing the HttpBridgeFactory. We do this here because
405 // building the user agent may block on some platforms. 405 // building the user agent may block on some platforms.
406 chrome::VersionInfo version_info; 406 chrome::VersionInfo version_info;
407 options->http_bridge_factory->Init( 407 options->http_bridge_factory->Init(
408 DeviceInfo::MakeUserAgentForSyncApi(version_info)); 408 LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi(version_info));
409 409
410 // Blow away the partial or corrupt sync data folder before doing any more 410 // Blow away the partial or corrupt sync data folder before doing any more
411 // initialization, if necessary. 411 // initialization, if necessary.
412 if (options->delete_sync_data_folder) { 412 if (options->delete_sync_data_folder) {
413 DeleteSyncDataFolder(); 413 DeleteSyncDataFolder();
414 } 414 }
415 415
416 // Make sure that the directory exists before initializing the backend. 416 // Make sure that the directory exists before initializing the backend.
417 // If it already exists, this will do no harm. 417 // If it already exists, this will do no harm.
418 if (!base::CreateDirectory(sync_data_folder_path_)) { 418 if (!base::CreateDirectory(sync_data_folder_path_)) {
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), 728 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds),
729 this, &SyncBackendHostCore::SaveChanges); 729 this, &SyncBackendHostCore::SaveChanges);
730 } 730 }
731 731
732 void SyncBackendHostCore::SaveChanges() { 732 void SyncBackendHostCore::SaveChanges() {
733 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 733 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
734 sync_manager_->SaveChanges(); 734 sync_manager_->SaveChanges();
735 } 735 }
736 736
737 } // namespace browser_sync 737 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/local_device_info_provider_unittest.cc ('k') | chrome/browser/sync/sessions/sessions_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698