| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #if defined(BROWSER_SYNC) | 5 #if defined(BROWSER_SYNC) |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 processor_(processor), | 33 processor_(processor), |
| 34 sync_data_folder_path_(profile_path.Append(kSyncDataFolderName)), | 34 sync_data_folder_path_(profile_path.Append(kSyncDataFolderName)), |
| 35 last_auth_error_(AUTH_ERROR_NONE) { | 35 last_auth_error_(AUTH_ERROR_NONE) { |
| 36 core_ = new Core(this); | 36 core_ = new Core(this); |
| 37 } | 37 } |
| 38 | 38 |
| 39 SyncBackendHost::~SyncBackendHost() { | 39 SyncBackendHost::~SyncBackendHost() { |
| 40 DCHECK(!core_ && !frontend_) << "Must call Shutdown before destructor."; | 40 DCHECK(!core_ && !frontend_) << "Must call Shutdown before destructor."; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void SyncBackendHost::Initialize(const GURL& sync_service_url, | 43 void SyncBackendHost::Initialize( |
| 44 URLRequestContext* baseline_context) { | 44 const GURL& sync_service_url, |
| 45 URLRequestContextGetter* baseline_context_getter) { |
| 45 if (!core_thread_.Start()) | 46 if (!core_thread_.Start()) |
| 46 return; | 47 return; |
| 47 bookmark_model_worker_ = new BookmarkModelWorker(frontend_loop_); | 48 bookmark_model_worker_ = new BookmarkModelWorker(frontend_loop_); |
| 48 | 49 |
| 49 core_thread_.message_loop()->PostTask(FROM_HERE, | 50 core_thread_.message_loop()->PostTask(FROM_HERE, |
| 50 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoInitialize, | 51 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoInitialize, |
| 51 sync_service_url, bookmark_model_worker_, true, | 52 sync_service_url, bookmark_model_worker_, true, |
| 52 new HttpBridgeFactory(baseline_context), | 53 new HttpBridgeFactory(baseline_context_getter), |
| 53 new HttpBridgeFactory(baseline_context))); | 54 new HttpBridgeFactory(baseline_context_getter))); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void SyncBackendHost::Authenticate(const std::string& username, | 57 void SyncBackendHost::Authenticate(const std::string& username, |
| 57 const std::string& password) { | 58 const std::string& password) { |
| 58 core_thread_.message_loop()->PostTask(FROM_HERE, | 59 core_thread_.message_loop()->PostTask(FROM_HERE, |
| 59 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoAuthenticate, | 60 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoAuthenticate, |
| 60 username, password)); | 61 username, password)); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void SyncBackendHost::Shutdown(bool sync_disabled) { | 64 void SyncBackendHost::Shutdown(bool sync_disabled) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 this, &Core::SaveChanges); | 308 this, &Core::SaveChanges); |
| 308 } | 309 } |
| 309 | 310 |
| 310 void SyncBackendHost::Core::SaveChanges() { | 311 void SyncBackendHost::Core::SaveChanges() { |
| 311 syncapi_->SaveChanges(); | 312 syncapi_->SaveChanges(); |
| 312 } | 313 } |
| 313 | 314 |
| 314 } // namespace browser_sync | 315 } // namespace browser_sync |
| 315 | 316 |
| 316 #endif // defined(BROWSER_SYNC) | 317 #endif // defined(BROWSER_SYNC) |
| OLD | NEW |