| 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/sync_manager.h" | 5 #include "sync/internal_api/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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "sync/notifier/sync_notifier.h" | 45 #include "sync/notifier/sync_notifier.h" |
| 46 #include "sync/notifier/sync_notifier_observer.h" | 46 #include "sync/notifier/sync_notifier_observer.h" |
| 47 #include "sync/protocol/encryption.pb.h" | 47 #include "sync/protocol/encryption.pb.h" |
| 48 #include "sync/protocol/proto_value_conversions.h" | 48 #include "sync/protocol/proto_value_conversions.h" |
| 49 #include "sync/protocol/sync.pb.h" | 49 #include "sync/protocol/sync.pb.h" |
| 50 #include "sync/syncable/directory_change_delegate.h" | 50 #include "sync/syncable/directory_change_delegate.h" |
| 51 #include "sync/syncable/model_type.h" | 51 #include "sync/syncable/model_type.h" |
| 52 #include "sync/syncable/model_type_payload_map.h" | 52 #include "sync/syncable/model_type_payload_map.h" |
| 53 #include "sync/syncable/syncable.h" | 53 #include "sync/syncable/syncable.h" |
| 54 #include "sync/util/cryptographer.h" | 54 #include "sync/util/cryptographer.h" |
| 55 #include "sync/util/experiments.h" |
| 55 #include "sync/util/get_session_name.h" | 56 #include "sync/util/get_session_name.h" |
| 56 #include "sync/util/time.h" | 57 #include "sync/util/time.h" |
| 57 | 58 |
| 58 using base::TimeDelta; | 59 using base::TimeDelta; |
| 59 using browser_sync::AllStatus; | 60 using browser_sync::AllStatus; |
| 60 using browser_sync::Cryptographer; | 61 using browser_sync::Cryptographer; |
| 61 using browser_sync::Encryptor; | 62 using browser_sync::Encryptor; |
| 62 using browser_sync::JsArgList; | 63 using browser_sync::JsArgList; |
| 63 using browser_sync::JsBackend; | 64 using browser_sync::JsBackend; |
| 64 using browser_sync::JsEventDetails; | 65 using browser_sync::JsEventDetails; |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2471 TimeDelta SyncManager::GetNudgeDelayTimeDelta( | 2472 TimeDelta SyncManager::GetNudgeDelayTimeDelta( |
| 2472 const ModelType& model_type) { | 2473 const ModelType& model_type) { |
| 2473 return data_->GetNudgeDelayTimeDelta(model_type); | 2474 return data_->GetNudgeDelayTimeDelta(model_type); |
| 2474 } | 2475 } |
| 2475 | 2476 |
| 2476 syncable::ModelTypeSet SyncManager::GetEncryptedDataTypesForTest() const { | 2477 syncable::ModelTypeSet SyncManager::GetEncryptedDataTypesForTest() const { |
| 2477 ReadTransaction trans(FROM_HERE, GetUserShare()); | 2478 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 2478 return GetEncryptedTypes(&trans); | 2479 return GetEncryptedTypes(&trans); |
| 2479 } | 2480 } |
| 2480 | 2481 |
| 2481 bool SyncManager::ReceivedExperimentalTypes(syncable::ModelTypeSet* to_add) | 2482 bool SyncManager::ReceivedExperiment(browser_sync::Experiments* experiments) |
| 2482 const { | 2483 const { |
| 2483 ReadTransaction trans(FROM_HERE, GetUserShare()); | 2484 ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 2484 ReadNode node(&trans); | 2485 ReadNode node(&trans); |
| 2485 if (node.InitByTagLookup(kNigoriTag) != sync_api::BaseNode::INIT_OK) { | 2486 if (node.InitByTagLookup(kNigoriTag) != sync_api::BaseNode::INIT_OK) { |
| 2486 DVLOG(1) << "Couldn't find Nigori node."; | 2487 DVLOG(1) << "Couldn't find Nigori node."; |
| 2487 return false; | 2488 return false; |
| 2488 } | 2489 } |
| 2490 bool found_experiment = false; |
| 2489 if (node.GetNigoriSpecifics().sync_tabs()) { | 2491 if (node.GetNigoriSpecifics().sync_tabs()) { |
| 2490 to_add->Put(syncable::SESSIONS); | 2492 experiments->sync_tabs = true; |
| 2491 return true; | 2493 found_experiment = true; |
| 2492 } | 2494 } |
| 2493 return false; | 2495 if (node.GetNigoriSpecifics().sync_tab_favicons()) { |
| 2496 experiments->sync_tab_favicons = true; |
| 2497 found_experiment = true; |
| 2498 } |
| 2499 return found_experiment; |
| 2494 } | 2500 } |
| 2495 | 2501 |
| 2496 bool SyncManager::HasUnsyncedItems() const { | 2502 bool SyncManager::HasUnsyncedItems() const { |
| 2497 sync_api::ReadTransaction trans(FROM_HERE, GetUserShare()); | 2503 sync_api::ReadTransaction trans(FROM_HERE, GetUserShare()); |
| 2498 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); | 2504 return (trans.GetWrappedTrans()->directory()->unsynced_entity_count() != 0); |
| 2499 } | 2505 } |
| 2500 | 2506 |
| 2501 void SyncManager::TriggerOnNotificationStateChangeForTest( | 2507 void SyncManager::TriggerOnNotificationStateChangeForTest( |
| 2502 bool notifications_enabled) { | 2508 bool notifications_enabled) { |
| 2503 DCHECK(thread_checker_.CalledOnValidThread()); | 2509 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 share->directory->GetDownloadProgress(i.Get(), &marker); | 2572 share->directory->GetDownloadProgress(i.Get(), &marker); |
| 2567 | 2573 |
| 2568 if (marker.token().empty()) | 2574 if (marker.token().empty()) |
| 2569 result.Put(i.Get()); | 2575 result.Put(i.Get()); |
| 2570 | 2576 |
| 2571 } | 2577 } |
| 2572 return result; | 2578 return result; |
| 2573 } | 2579 } |
| 2574 | 2580 |
| 2575 } // namespace sync_api | 2581 } // namespace sync_api |
| OLD | NEW |