OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/engine/syncapi.h" | 5 #include "chrome/browser/sync/engine/syncapi.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 FilePath settings_db_file = | 1079 FilePath settings_db_file = |
1080 database_location.Append(FilePath(kBookmarkSyncUserSettingsDatabase)); | 1080 database_location.Append(FilePath(kBookmarkSyncUserSettingsDatabase)); |
1081 user_settings_.reset(new UserSettings()); | 1081 user_settings_.reset(new UserSettings()); |
1082 if (!user_settings_->Init(settings_db_file)) | 1082 if (!user_settings_->Init(settings_db_file)) |
1083 return false; | 1083 return false; |
1084 | 1084 |
1085 share_.dir_manager.reset(new DirectoryManager(database_location)); | 1085 share_.dir_manager.reset(new DirectoryManager(database_location)); |
1086 | 1086 |
1087 string client_id = user_settings_->GetClientId(); | 1087 string client_id = user_settings_->GetClientId(); |
1088 connection_manager_.reset(new SyncAPIServerConnectionManager( | 1088 connection_manager_.reset(new SyncAPIServerConnectionManager( |
1089 sync_server_and_path, port, use_ssl, user_agent, client_id)); | 1089 sync_server_and_path, port, use_ssl, user_agent, client_id, |
| 1090 post_factory)); |
1090 | 1091 |
1091 // TODO(timsteele): This is temporary windows crap needed to listen for | 1092 // TODO(timsteele): This is temporary windows crap needed to listen for |
1092 // network status changes. We should either pump this up to the embedder to | 1093 // network status changes. We should either pump this up to the embedder to |
1093 // do (and call us in CheckServerReachable, for ex), or at least make this | 1094 // do (and call us in CheckServerReachable, for ex), or at least make this |
1094 // platform independent in here. | 1095 // platform independent in here. |
1095 #if defined(OS_WIN) | 1096 #if defined(OS_WIN) |
1096 HANDLE exit_flag = CreateEvent(NULL, TRUE /*manual reset*/, FALSE, NULL); | 1097 HANDLE exit_flag = CreateEvent(NULL, TRUE /*manual reset*/, FALSE, NULL); |
1097 address_watch_params_.exit_flag = exit_flag; | 1098 address_watch_params_.exit_flag = exit_flag; |
1098 #elif defined(OS_LINUX) | 1099 #elif defined(OS_LINUX) |
1099 if (pipe(address_watch_params_.exit_pipe) == -1) { | 1100 if (pipe(address_watch_params_.exit_pipe) == -1) { |
(...skipping 10 matching lines...) Expand all Loading... |
1110 | 1111 |
1111 #if defined(OS_MACOSX) | 1112 #if defined(OS_MACOSX) |
1112 { | 1113 { |
1113 AutoLock auto_lock(address_watch_params_.run_loop_lock); | 1114 AutoLock auto_lock(address_watch_params_.run_loop_lock); |
1114 while (!address_watch_params_.run_loop_initialized) { | 1115 while (!address_watch_params_.run_loop_initialized) { |
1115 address_watch_params_.params_set.Wait(); | 1116 address_watch_params_.params_set.Wait(); |
1116 } | 1117 } |
1117 } | 1118 } |
1118 #endif | 1119 #endif |
1119 | 1120 |
1120 // Hand over the bridged POST factory to be owned by the connection | |
1121 // dir_manager. | |
1122 connection_manager()->SetHttpPostProviderFactory(post_factory); | |
1123 | |
1124 // Watch various objects for aggregated status. | 1121 // Watch various objects for aggregated status. |
1125 allstatus()->WatchConnectionManager(connection_manager()); | 1122 allstatus()->WatchConnectionManager(connection_manager()); |
1126 | 1123 |
1127 std::string gaia_url = browser_sync::kGaiaUrl; | 1124 std::string gaia_url = browser_sync::kGaiaUrl; |
1128 const char* service_id = gaia_service_id ? | 1125 const char* service_id = gaia_service_id ? |
1129 gaia_service_id : SYNC_SERVICE_NAME; | 1126 gaia_service_id : SYNC_SERVICE_NAME; |
1130 | 1127 |
1131 talk_mediator_.reset(new TalkMediatorImpl()); | 1128 talk_mediator_.reset(new TalkMediatorImpl()); |
1132 allstatus()->WatchTalkMediator(talk_mediator()); | 1129 allstatus()->WatchTalkMediator(talk_mediator()); |
1133 | 1130 |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 BaseTransaction::~BaseTransaction() { | 1692 BaseTransaction::~BaseTransaction() { |
1696 delete lookup_; | 1693 delete lookup_; |
1697 } | 1694 } |
1698 | 1695 |
1699 UserShare* SyncManager::GetUserShare() const { | 1696 UserShare* SyncManager::GetUserShare() const { |
1700 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; | 1697 DCHECK(data_->initialized()) << "GetUserShare requires initialization!"; |
1701 return data_->GetUserShare(); | 1698 return data_->GetUserShare(); |
1702 } | 1699 } |
1703 | 1700 |
1704 } // namespace sync_api | 1701 } // namespace sync_api |
OLD | NEW |