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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/sync/glue/device_info.h" | 10 #include "chrome/browser/sync/glue/device_info.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 DeviceInfo::MakeUserAgentForSyncApi(version_info)); | 342 DeviceInfo::MakeUserAgentForSyncApi(version_info)); |
343 | 343 |
344 // Blow away the partial or corrupt sync data folder before doing any more | 344 // Blow away the partial or corrupt sync data folder before doing any more |
345 // initialization, if necessary. | 345 // initialization, if necessary. |
346 if (options->delete_sync_data_folder) { | 346 if (options->delete_sync_data_folder) { |
347 DeleteSyncDataFolder(); | 347 DeleteSyncDataFolder(); |
348 } | 348 } |
349 | 349 |
350 // Make sure that the directory exists before initializing the backend. | 350 // Make sure that the directory exists before initializing the backend. |
351 // If it already exists, this will do no harm. | 351 // If it already exists, this will do no harm. |
352 if (!file_util::CreateDirectory(sync_data_folder_path_)) { | 352 if (!base::CreateDirectory(sync_data_folder_path_)) { |
353 DLOG(FATAL) << "Sync Data directory creation failed."; | 353 DLOG(FATAL) << "Sync Data directory creation failed."; |
354 } | 354 } |
355 | 355 |
356 DCHECK(!registrar_); | 356 DCHECK(!registrar_); |
357 registrar_ = options->registrar; | 357 registrar_ = options->registrar; |
358 DCHECK(registrar_); | 358 DCHECK(registrar_); |
359 | 359 |
360 sync_manager_ = options->sync_manager_factory->CreateSyncManager(name_); | 360 sync_manager_ = options->sync_manager_factory->CreateSyncManager(name_); |
361 sync_manager_->AddObserver(this); | 361 sync_manager_->AddObserver(this); |
362 sync_manager_->Init(sync_data_folder_path_, | 362 sync_manager_->Init(sync_data_folder_path_, |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 this, &SyncBackendHostCore::SaveChanges); | 613 this, &SyncBackendHostCore::SaveChanges); |
614 } | 614 } |
615 | 615 |
616 void SyncBackendHostCore::SaveChanges() { | 616 void SyncBackendHostCore::SaveChanges() { |
617 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); | 617 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); |
618 sync_manager_->SaveChanges(); | 618 sync_manager_->SaveChanges(); |
619 } | 619 } |
620 | 620 |
621 } // namespace browser_sync | 621 } // namespace browser_sync |
622 | 622 |
OLD | NEW |