| Index: chrome/browser/sync/internal_api/sync_manager.cc
|
| diff --git a/chrome/browser/sync/internal_api/sync_manager.cc b/chrome/browser/sync/internal_api/sync_manager.cc
|
| index 01f1712e7f9e381dc3d20985ff860c59f9ab2aa9..bc7cd1697031bae71c9845ad2c09a5497f229c5e 100644
|
| --- a/chrome/browser/sync/internal_api/sync_manager.cc
|
| +++ b/chrome/browser/sync/internal_api/sync_manager.cc
|
| @@ -8,6 +8,7 @@
|
| #include <vector>
|
|
|
| #include "base/base64.h"
|
| +#include "base/command_line.h"
|
| #include "base/json/json_writer.h"
|
| #include "base/string_number_conversions.h"
|
| #include "base/values.h"
|
| @@ -41,6 +42,7 @@
|
| #include "chrome/browser/sync/syncable/syncable.h"
|
| #include "chrome/browser/sync/util/cryptographer.h"
|
| #include "chrome/browser/sync/weak_handle.h"
|
| +#include "chrome/common/chrome_switches.h"
|
| #include "net/base/network_change_notifier.h"
|
|
|
| using std::string;
|
| @@ -235,6 +237,10 @@ class SyncManager::SyncInternal
|
| // Called when the user disables or enables a sync type.
|
| void UpdateEnabledTypes();
|
|
|
| + // Conditionally sets the flag in the Nigori node which instructs other
|
| + // clients to start syncing tabs.
|
| + void MaybeSetSyncTabsInNigoriNode(const syncable::ModelTypeSet enabled_types);
|
| +
|
| // Tell the sync engine to start the syncing process.
|
| void StartSyncingNormally();
|
|
|
| @@ -656,6 +662,11 @@ void SyncManager::UpdateEnabledTypes() {
|
| data_->UpdateEnabledTypes();
|
| }
|
|
|
| +void SyncManager::MaybeSetSyncTabsInNigoriNode(
|
| + const syncable::ModelTypeSet enabled_types) {
|
| + data_->MaybeSetSyncTabsInNigoriNode(enabled_types);
|
| +}
|
| +
|
| bool SyncManager::InitialSyncEndedForAllEnabledTypes() {
|
| return data_->InitialSyncEndedForAllEnabledTypes();
|
| }
|
| @@ -942,6 +953,27 @@ void SyncManager::SyncInternal::UpdateEnabledTypes() {
|
| enabled_types.insert(it->first);
|
| }
|
| sync_notifier_->UpdateEnabledTypes(enabled_types);
|
| + if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableSyncSessionsForOtherClients)) {
|
| + MaybeSetSyncTabsInNigoriNode(enabled_types);
|
| + }
|
| +}
|
| +
|
| +void SyncManager::SyncInternal::MaybeSetSyncTabsInNigoriNode(
|
| + const syncable::ModelTypeSet enabled_types) {
|
| + if (enabled_types.count(syncable::SESSIONS) > 0) {
|
| + WriteTransaction trans(FROM_HERE, GetUserShare());
|
| + WriteNode node(&trans);
|
| + if (!node.InitByTagLookup(kNigoriTag)) {
|
| + NOTREACHED() << "Unable to set 'sync_tabs' bit because Nigori node not "
|
| + << "found.";
|
| + return;
|
| + }
|
| +
|
| + sync_pb::NigoriSpecifics specifics(node.GetNigoriSpecifics());
|
| + specifics.set_sync_tabs(true);
|
| + node.SetNigoriSpecifics(specifics);
|
| + }
|
| }
|
|
|
| void SyncManager::SyncInternal::RaiseAuthNeededEvent() {
|
|
|