Index: chrome/browser/sync/sync_prefs.cc |
diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc |
index 3d9be89d17f64ea34649e32c0ccdfbeab0d73f30..e2c40ddd12b6d349788d36f2e5791851d85faaee 100644 |
--- a/chrome/browser/sync/sync_prefs.cc |
+++ b/chrome/browser/sync/sync_prefs.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/sync/sync_prefs.h" |
+#include "base/command_line.h" |
#include "base/logging.h" |
#include "base/prefs/pref_service.h" |
#include "base/prefs/public/pref_member.h" |
@@ -14,6 +15,7 @@ |
#include "chrome/browser/profiles/profile_io_data.h" |
#include "chrome/browser/sync/profile_sync_service.h" |
#include "chrome/common/chrome_notification_types.h" |
+#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/notification_details.h" |
@@ -320,6 +322,8 @@ const char* SyncPrefs::GetPrefNameForDataType(syncer::ModelType data_type) { |
return prefs::kSyncFaviconImages; |
case syncer::FAVICON_TRACKING: |
return prefs::kSyncFaviconTracking; |
+ case syncer::PROXY_TABS: |
+ return prefs::kSyncTabs; |
default: |
break; |
} |
@@ -387,13 +391,20 @@ void SyncPrefs::RegisterPrefGroups() { |
pref_groups_[syncer::PREFERENCES].Put(syncer::DICTIONARY); |
pref_groups_[syncer::PREFERENCES].Put(syncer::SEARCH_ENGINES); |
+ pref_groups_[syncer::TYPED_URLS].Put(syncer::HISTORY_DELETE_DIRECTIVES); |
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
+ if (command_line.HasSwitch(switches::kHistoryEnableFullHistorySync)) { |
+ pref_groups_[syncer::TYPED_URLS].Put(syncer::SESSIONS); |
+ pref_groups_[syncer::TYPED_URLS].Put(syncer::FAVICON_IMAGES); |
+ pref_groups_[syncer::TYPED_URLS].Put(syncer::FAVICON_TRACKING); |
+ } |
+ |
+ pref_groups_[syncer::PROXY_TABS].Put(syncer::SESSIONS); |
+ pref_groups_[syncer::PROXY_TABS].Put(syncer::FAVICON_IMAGES); |
+ pref_groups_[syncer::PROXY_TABS].Put(syncer::FAVICON_TRACKING); |
+ |
// TODO(zea): put favicons in the bookmarks group as well once it handles |
// those favicons. |
- pref_groups_[syncer::SESSIONS].Put(syncer::FAVICON_IMAGES); |
- pref_groups_[syncer::SESSIONS].Put(syncer::FAVICON_TRACKING); |
- |
- // TODO(akalin): Revisit this once UI lands. |
- pref_groups_[syncer::SESSIONS].Put(syncer::HISTORY_DELETE_DIRECTIVES); |
} |
// static |
@@ -419,6 +430,13 @@ bool SyncPrefs::GetDataTypePreferred(syncer::ModelType type) const { |
NOTREACHED(); |
return false; |
} |
+ if (type == syncer::PROXY_TABS && |
+ pref_service_->GetUserPrefValue(pref_name) == NULL && |
+ pref_service_->IsUserModifiablePreference(pref_name)) { |
+ // If there is no tab sync preference yet (i.e. newly enabled type), |
+ // default to the session sync preference value. |
+ pref_name = GetPrefNameForDataType(syncer::SESSIONS); |
+ } |
return pref_service_->GetBoolean(pref_name); |
} |
@@ -444,8 +462,6 @@ syncer::ModelTypeSet SyncPrefs::ResolvePrefGroups( |
i != pref_groups_.end(); ++i) { |
if (types.Has(i->first)) |
types_with_groups.PutAll(i->second); |
- else |
- types_with_groups.RemoveAll(i->second); |
} |
types_with_groups.RetainAll(registered_types); |
return types_with_groups; |