| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sync/internal_api/public/sync_manager.h" | 5 #include "sync/internal_api/public/sync_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "sync/syncable/directory_change_delegate.h" | 55 #include "sync/syncable/directory_change_delegate.h" |
| 56 #include "sync/syncable/entry.h" | 56 #include "sync/syncable/entry.h" |
| 57 #include "sync/syncable/in_memory_directory_backing_store.h" | 57 #include "sync/syncable/in_memory_directory_backing_store.h" |
| 58 #include "sync/syncable/nigori_util.h" | 58 #include "sync/syncable/nigori_util.h" |
| 59 #include "sync/syncable/on_disk_directory_backing_store.h" | 59 #include "sync/syncable/on_disk_directory_backing_store.h" |
| 60 #include "sync/util/cryptographer.h" | 60 #include "sync/util/cryptographer.h" |
| 61 #include "sync/util/get_session_name.h" | 61 #include "sync/util/get_session_name.h" |
| 62 #include "sync/util/time.h" | 62 #include "sync/util/time.h" |
| 63 | 63 |
| 64 using base::TimeDelta; | 64 using base::TimeDelta; |
| 65 using syncer::AllStatus; | |
| 66 using syncer::Cryptographer; | |
| 67 using syncer::Encryptor; | |
| 68 using syncer::JsArgList; | |
| 69 using syncer::JsBackend; | |
| 70 using syncer::JsEventDetails; | |
| 71 using syncer::JsEventHandler; | |
| 72 using syncer::JsEventHandler; | |
| 73 using syncer::JsReplyHandler; | |
| 74 using syncer::JsMutationEventObserver; | |
| 75 using syncer::JsSyncManagerObserver; | |
| 76 using syncer::kNigoriTag; | |
| 77 using syncer::KeyParams; | |
| 78 using syncer::ModelSafeRoutingInfo; | |
| 79 using syncer::ReportUnrecoverableErrorFunction; | |
| 80 using syncer::ServerConnectionEvent; | |
| 81 using syncer::ServerConnectionEventListener; | |
| 82 using syncer::SyncEngineEvent; | |
| 83 using syncer::SyncEngineEventListener; | |
| 84 using syncer::SyncScheduler; | |
| 85 using syncer::Syncer; | |
| 86 using syncer::UnrecoverableErrorHandler; | |
| 87 using syncer::WeakHandle; | |
| 88 using syncer::sessions::SyncSessionContext; | |
| 89 using syncable::ImmutableWriteTransactionInfo; | |
| 90 using syncable::ModelType; | |
| 91 using syncable::ModelTypeSet; | |
| 92 using syncable::SPECIFICS; | |
| 93 using sync_pb::GetUpdatesCallerInfo; | 65 using sync_pb::GetUpdatesCallerInfo; |
| 94 | 66 |
| 95 namespace { | 67 namespace { |
| 96 | 68 |
| 97 // Delays for syncer nudges. | 69 // Delays for syncer nudges. |
| 98 static const int kSyncRefreshDelayMsec = 500; | 70 static const int kSyncRefreshDelayMsec = 500; |
| 99 static const int kSyncSchedulerDelayMsec = 250; | 71 static const int kSyncSchedulerDelayMsec = 250; |
| 100 | 72 |
| 101 GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason( | 73 GetUpdatesCallerInfo::GetUpdatesSource GetSourceFromReason( |
| 102 syncer::ConfigureReason reason) { | 74 syncer::ConfigureReason reason) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 117 } | 89 } |
| 118 | 90 |
| 119 // The maximum number of times we will automatically overwrite the nigori node | 91 // The maximum number of times we will automatically overwrite the nigori node |
| 120 // because the encryption keys don't match (per chrome instantiation). | 92 // because the encryption keys don't match (per chrome instantiation). |
| 121 static const int kNigoriOverwriteLimit = 10; | 93 static const int kNigoriOverwriteLimit = 10; |
| 122 | 94 |
| 123 } // namespace | 95 } // namespace |
| 124 | 96 |
| 125 namespace syncer { | 97 namespace syncer { |
| 126 | 98 |
| 99 using sessions::SyncSessionContext; |
| 100 using syncable::ImmutableWriteTransactionInfo; |
| 101 using syncable::ModelType; |
| 102 using syncable::ModelTypeSet; |
| 103 using syncable::SPECIFICS; |
| 104 |
| 127 const int SyncManager::kDefaultNudgeDelayMilliseconds = 200; | 105 const int SyncManager::kDefaultNudgeDelayMilliseconds = 200; |
| 128 const int SyncManager::kPreferencesNudgeDelayMilliseconds = 2000; | 106 const int SyncManager::kPreferencesNudgeDelayMilliseconds = 2000; |
| 129 | 107 |
| 130 // Maximum count and size for traffic recorder. | 108 // Maximum count and size for traffic recorder. |
| 131 const unsigned int kMaxMessagesToRecord = 10; | 109 const unsigned int kMaxMessagesToRecord = 10; |
| 132 const unsigned int kMaxMessageSizeToRecord = 5 * 1024; | 110 const unsigned int kMaxMessageSizeToRecord = 5 * 1024; |
| 133 | 111 |
| 134 ////////////////////////////////////////////////////////////////////////// | 112 ////////////////////////////////////////////////////////////////////////// |
| 135 // SyncManager's implementation: SyncManager::SyncInternal | 113 // SyncManager's implementation: SyncManager::SyncInternal |
| 136 class SyncManager::SyncInternal | 114 class SyncManager::SyncInternal |
| (...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2495 share->directory->GetDownloadProgress(i.Get(), &marker); | 2473 share->directory->GetDownloadProgress(i.Get(), &marker); |
| 2496 | 2474 |
| 2497 if (marker.token().empty()) | 2475 if (marker.token().empty()) |
| 2498 result.Put(i.Get()); | 2476 result.Put(i.Get()); |
| 2499 | 2477 |
| 2500 } | 2478 } |
| 2501 return result; | 2479 return result; |
| 2502 } | 2480 } |
| 2503 | 2481 |
| 2504 } // namespace syncer | 2482 } // namespace syncer |
| OLD | NEW |