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 "chrome/browser/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 const syncable::ModelTypeSet to_register = | 697 const syncable::ModelTypeSet to_register = |
698 Difference(to_add, registered_types); | 698 Difference(to_add, registered_types); |
699 | 699 |
700 DVLOG(2) << "Enabling types: " << syncable::ModelTypeSetToString(to_register); | 700 DVLOG(2) << "Enabling types: " << syncable::ModelTypeSetToString(to_register); |
701 | 701 |
702 for (syncable::ModelTypeSet::Iterator it = to_register.First(); | 702 for (syncable::ModelTypeSet::Iterator it = to_register.First(); |
703 it.Good(); it.Inc()) { | 703 it.Good(); it.Inc()) { |
704 // Received notice to enable experimental type. Check if the type is | 704 // Received notice to enable experimental type. Check if the type is |
705 // registered, and if not register a new datatype controller. | 705 // registered, and if not register a new datatype controller. |
706 RegisterNewDataType(it.Get()); | 706 RegisterNewDataType(it.Get()); |
| 707 #if !defined(OS_ANDROID) |
707 // Enable the about:flags switch for the experimental type so we don't have | 708 // Enable the about:flags switch for the experimental type so we don't have |
708 // to always perform this reconfiguration. Once we set this, the type will | 709 // to always perform this reconfiguration. Once we set this, the type will |
709 // remain registered on restart, so we will no longer go down this code | 710 // remain registered on restart, so we will no longer go down this code |
710 // path. | 711 // path. |
711 std::string experiment_name = GetExperimentNameForDataType(it.Get()); | 712 std::string experiment_name = GetExperimentNameForDataType(it.Get()); |
712 if (experiment_name.empty()) | 713 if (experiment_name.empty()) |
713 continue; | 714 continue; |
714 about_flags::SetExperimentEnabled(g_browser_process->local_state(), | 715 about_flags::SetExperimentEnabled(g_browser_process->local_state(), |
715 experiment_name, | 716 experiment_name, |
716 true); | 717 true); |
| 718 #endif // !defined(OS_ANDROID) |
717 } | 719 } |
718 | 720 |
719 // Check if the user has "Keep Everything Synced" enabled. If so, we want | 721 // Check if the user has "Keep Everything Synced" enabled. If so, we want |
720 // to turn on all experimental types if they're not already on. Otherwise we | 722 // to turn on all experimental types if they're not already on. Otherwise we |
721 // leave them off. | 723 // leave them off. |
722 // Note: if any types are already registered, we don't turn them on. This | 724 // Note: if any types are already registered, we don't turn them on. This |
723 // covers the case where we're already in the process of reconfiguring | 725 // covers the case where we're already in the process of reconfiguring |
724 // to turn an experimental type on. | 726 // to turn an experimental type on. |
725 if (sync_prefs_.HasKeepEverythingSynced()) { | 727 if (sync_prefs_.HasKeepEverythingSynced()) { |
726 // Mark all data types as preferred. | 728 // Mark all data types as preferred. |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 OnStopSyncingPermanently(); | 962 OnStopSyncingPermanently(); |
961 break; | 963 break; |
962 default: | 964 default: |
963 NOTREACHED(); | 965 NOTREACHED(); |
964 } | 966 } |
965 NotifyObservers(); | 967 NotifyObservers(); |
966 } | 968 } |
967 | 969 |
968 void ProfileSyncService::ShowErrorUI() { | 970 void ProfileSyncService::ShowErrorUI() { |
969 // TODO(atwilson): Remove this. | 971 // TODO(atwilson): Remove this. |
| 972 #if defined(OS_ANDROID) |
| 973 // Android uses native UI for sync setup. |
| 974 NOTREACHED(); |
| 975 #else |
970 LoginUIServiceFactory::GetForProfile(profile_)->ShowLoginUI(false); | 976 LoginUIServiceFactory::GetForProfile(profile_)->ShowLoginUI(false); |
| 977 #endif |
971 } | 978 } |
972 | 979 |
973 std::string ProfileSyncService::QuerySyncStatusSummary() { | 980 std::string ProfileSyncService::QuerySyncStatusSummary() { |
974 if (unrecoverable_error_detected_) { | 981 if (unrecoverable_error_detected_) { |
975 return "Unrecoverable error detected"; | 982 return "Unrecoverable error detected"; |
976 } else if (!backend_.get()) { | 983 } else if (!backend_.get()) { |
977 return "Syncing not enabled"; | 984 return "Syncing not enabled"; |
978 } else if (backend_.get() && !HasSyncSetupCompleted()) { | 985 } else if (backend_.get() && !HasSyncSetupCompleted()) { |
979 return "First time sync setup incomplete"; | 986 return "First time sync setup incomplete"; |
980 } else if (backend_.get() && HasSyncSetupCompleted() && | 987 } else if (backend_.get() && HasSyncSetupCompleted() && |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. | 1617 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine
d-behaviour-after-directly-calling-the-destru. |
1611 ProfileSyncService* old_this = this; | 1618 ProfileSyncService* old_this = this; |
1612 this->~ProfileSyncService(); | 1619 this->~ProfileSyncService(); |
1613 new(old_this) ProfileSyncService( | 1620 new(old_this) ProfileSyncService( |
1614 new ProfileSyncComponentsFactoryImpl(profile, | 1621 new ProfileSyncComponentsFactoryImpl(profile, |
1615 CommandLine::ForCurrentProcess()), | 1622 CommandLine::ForCurrentProcess()), |
1616 profile, | 1623 profile, |
1617 signin, | 1624 signin, |
1618 behavior); | 1625 behavior); |
1619 } | 1626 } |
OLD | NEW |