| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <bitset> | 8 #include <bitset> |
| 9 #include <iomanip> | 9 #include <iomanip> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 public: | 1202 public: |
| 1203 explicit SyncInternal(SyncManager* sync_manager) | 1203 explicit SyncInternal(SyncManager* sync_manager) |
| 1204 : core_message_loop_(NULL), | 1204 : core_message_loop_(NULL), |
| 1205 parent_router_(NULL), | 1205 parent_router_(NULL), |
| 1206 sync_manager_(sync_manager), | 1206 sync_manager_(sync_manager), |
| 1207 registrar_(NULL), | 1207 registrar_(NULL), |
| 1208 initialized_(false), | 1208 initialized_(false), |
| 1209 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 1209 method_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 1210 js_directory_change_listener_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 1210 js_directory_change_listener_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| 1211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1211 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1212 // Pre-fill |notification_info_map_|. |
| 1213 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
| 1214 i < syncable::MODEL_TYPE_COUNT; ++i) { |
| 1215 notification_info_map_.insert( |
| 1216 std::make_pair(syncable::ModelTypeFromInt(i), NotificationInfo())); |
| 1217 } |
| 1212 } | 1218 } |
| 1213 | 1219 |
| 1214 virtual ~SyncInternal() { | 1220 virtual ~SyncInternal() { |
| 1215 CHECK(!core_message_loop_); | 1221 CHECK(!core_message_loop_); |
| 1216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1222 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1217 } | 1223 } |
| 1218 | 1224 |
| 1219 bool Init(const FilePath& database_location, | 1225 bool Init(const FilePath& database_location, |
| 1220 const std::string& sync_server_and_path, | 1226 const std::string& sync_server_and_path, |
| 1221 int port, | 1227 int port, |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 bool initialized_; | 1606 bool initialized_; |
| 1601 mutable base::Lock initialized_mutex_; | 1607 mutable base::Lock initialized_mutex_; |
| 1602 | 1608 |
| 1603 // True if the SyncManager should be running in test mode (no syncer thread | 1609 // True if the SyncManager should be running in test mode (no syncer thread |
| 1604 // actually communicating with the server). | 1610 // actually communicating with the server). |
| 1605 bool setup_for_test_mode_; | 1611 bool setup_for_test_mode_; |
| 1606 | 1612 |
| 1607 ScopedRunnableMethodFactory<SyncManager::SyncInternal> method_factory_; | 1613 ScopedRunnableMethodFactory<SyncManager::SyncInternal> method_factory_; |
| 1608 | 1614 |
| 1609 // Map used to store the notification info to be displayed in about:sync page. | 1615 // Map used to store the notification info to be displayed in about:sync page. |
| 1610 // TODO(lipalani) - prefill the map with enabled data types. | |
| 1611 NotificationInfoMap notification_info_map_; | 1616 NotificationInfoMap notification_info_map_; |
| 1612 | 1617 |
| 1613 browser_sync::JsDirectoryChangeListener js_directory_change_listener_; | 1618 browser_sync::JsDirectoryChangeListener js_directory_change_listener_; |
| 1614 }; | 1619 }; |
| 1615 const int SyncManager::SyncInternal::kDefaultNudgeDelayMilliseconds = 200; | 1620 const int SyncManager::SyncInternal::kDefaultNudgeDelayMilliseconds = 200; |
| 1616 const int SyncManager::SyncInternal::kPreferencesNudgeDelayMilliseconds = 2000; | 1621 const int SyncManager::SyncInternal::kPreferencesNudgeDelayMilliseconds = 2000; |
| 1617 | 1622 |
| 1618 SyncManager::Observer::~Observer() {} | 1623 SyncManager::Observer::~Observer() {} |
| 1619 | 1624 |
| 1620 SyncManager::SyncManager() { | 1625 SyncManager::SyncManager() { |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2950 void SyncManager::TriggerOnIncomingNotificationForTest( | 2955 void SyncManager::TriggerOnIncomingNotificationForTest( |
| 2951 const syncable::ModelTypeBitSet& model_types) { | 2956 const syncable::ModelTypeBitSet& model_types) { |
| 2952 syncable::ModelTypePayloadMap model_types_with_payloads = | 2957 syncable::ModelTypePayloadMap model_types_with_payloads = |
| 2953 syncable::ModelTypePayloadMapFromBitSet(model_types, | 2958 syncable::ModelTypePayloadMapFromBitSet(model_types, |
| 2954 std::string()); | 2959 std::string()); |
| 2955 | 2960 |
| 2956 data_->OnIncomingNotification(model_types_with_payloads); | 2961 data_->OnIncomingNotification(model_types_with_payloads); |
| 2957 } | 2962 } |
| 2958 | 2963 |
| 2959 } // namespace sync_api | 2964 } // namespace sync_api |
| OLD | NEW |