| Index: chrome/browser/sync/profile_sync_service.cc
|
| diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
|
| index 2e704e3c97434d120980d988e8191fabf7c2be27..2a6ccef9d08ebb93ba38a9046d95dd1428ebe8e8 100644
|
| --- a/chrome/browser/sync/profile_sync_service.cc
|
| +++ b/chrome/browser/sync/profile_sync_service.cc
|
| @@ -79,6 +79,7 @@
|
| #include "sync/internal_api/public/configure_reason.h"
|
| #include "sync/internal_api/public/http_bridge_network_resources.h"
|
| #include "sync/internal_api/public/network_resources.h"
|
| +#include "sync/internal_api/public/sync_core_proxy.h"
|
| #include "sync/internal_api/public/sync_encryption_handler.h"
|
| #include "sync/internal_api/public/util/experiments.h"
|
| #include "sync/internal_api/public/util/sync_string_conversions.h"
|
| @@ -345,10 +346,18 @@ void ProfileSyncService::UnregisterAuthNotifications() {
|
| void ProfileSyncService::RegisterDataTypeController(
|
| DataTypeController* data_type_controller) {
|
| DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U);
|
| + DCHECK(!GetRegisteredNonBlockingDataTypes().Has(
|
| + data_type_controller->type()));
|
| data_type_controllers_[data_type_controller->type()] =
|
| data_type_controller;
|
| }
|
|
|
| +void ProfileSyncService::RegisterNonBlockingType(syncer::ModelType type) {
|
| + DCHECK_EQ(data_type_controllers_.count(type), 0U);
|
| + DCHECK(!GetRegisteredNonBlockingDataTypes().Has(type));
|
| + non_blocking_types_.Put(type);
|
| +}
|
| +
|
| browser_sync::SessionModelAssociator*
|
| ProfileSyncService::GetSessionModelAssociatorDeprecated() {
|
| if (!IsSessionsDataTypeControllerRunning())
|
| @@ -939,6 +948,8 @@ void ProfileSyncService::OnBackendInitialized(
|
| backend_->RequestBufferedProtocolEventsAndEnableForwarding();
|
| }
|
|
|
| + syncer::SyncCoreProxy sync_core_proxy_ = backend_->GetSyncCoreProxy();
|
| +
|
| // If we have a cached passphrase use it to decrypt/encrypt data now that the
|
| // backend is initialized. We want to call this before notifying observers in
|
| // case this operation affects the "passphrase required" status.
|
| @@ -1213,7 +1224,7 @@ void ProfileSyncService::OnPassphraseRequired(
|
| << syncer::PassphraseRequiredReasonToString(reason);
|
| passphrase_required_reason_ = reason;
|
|
|
| - const syncer::ModelTypeSet types = GetPreferredDataTypes();
|
| + const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
|
| if (data_type_manager_) {
|
| // Reconfigure without the encrypted types (excluded implicitly via the
|
| // failed datatypes handler).
|
| @@ -1221,6 +1232,8 @@ void ProfileSyncService::OnPassphraseRequired(
|
| syncer::CONFIGURE_REASON_CRYPTO);
|
| }
|
|
|
| + // TODO(rlarocque): Support non-blocking types. http://crbug.com/351005.
|
| +
|
| // Notify observers that the passphrase status may have changed.
|
| NotifyObservers();
|
| }
|
| @@ -1241,13 +1254,15 @@ void ProfileSyncService::OnPassphraseAccepted() {
|
|
|
| // Make sure the data types that depend on the passphrase are started at
|
| // this time.
|
| - const syncer::ModelTypeSet types = GetPreferredDataTypes();
|
| + const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
|
| if (data_type_manager_) {
|
| // Re-enable any encrypted types if necessary.
|
| data_type_manager_->Configure(types,
|
| syncer::CONFIGURE_REASON_CRYPTO);
|
| }
|
|
|
| + // TODO(rlarocque): Support non-blocking types. http://crbug.com/351005.
|
| +
|
| NotifyObservers();
|
| }
|
|
|
| @@ -1674,7 +1689,27 @@ syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const {
|
| return preferred_types;
|
| }
|
|
|
| +syncer::ModelTypeSet
|
| +ProfileSyncService::GetPreferredDirectoryDataTypes() const {
|
| + const syncer::ModelTypeSet registered_directory_types =
|
| + GetRegisteredDirectoryDataTypes();
|
| + const syncer::ModelTypeSet preferred_types =
|
| + sync_prefs_.GetPreferredDataTypes(registered_directory_types);
|
| + return preferred_types;
|
| +}
|
| +
|
| +syncer::ModelTypeSet
|
| +ProfileSyncService::GetPreferredNonBlockingDataTypes() const {
|
| + return sync_prefs_.GetPreferredDataTypes(GetRegisteredNonBlockingDataTypes());
|
| +}
|
| +
|
| syncer::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const {
|
| + return Union(GetRegisteredDirectoryDataTypes(),
|
| + GetRegisteredNonBlockingDataTypes());
|
| +}
|
| +
|
| +syncer::ModelTypeSet
|
| +ProfileSyncService::GetRegisteredDirectoryDataTypes() const {
|
| syncer::ModelTypeSet registered_types;
|
| // The data_type_controllers_ are determined by command-line flags; that's
|
| // effectively what controls the values returned here.
|
| @@ -1686,6 +1721,11 @@ syncer::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const {
|
| return registered_types;
|
| }
|
|
|
| +syncer::ModelTypeSet
|
| +ProfileSyncService::GetRegisteredNonBlockingDataTypes() const {
|
| + return non_blocking_types_;
|
| +}
|
| +
|
| bool ProfileSyncService::IsUsingSecondaryPassphrase() const {
|
| syncer::PassphraseType passphrase_type = GetPassphraseType();
|
| return passphrase_type == syncer::FROZEN_IMPLICIT_PASSPHRASE ||
|
| @@ -1707,7 +1747,8 @@ bool ProfileSyncService::IsCryptographerReady(
|
|
|
| void ProfileSyncService::ConfigurePriorityDataTypes() {
|
| const syncer::ModelTypeSet priority_types =
|
| - Intersection(GetPreferredDataTypes(), syncer::PriorityUserTypes());
|
| + Intersection(GetPreferredDirectoryDataTypes(),
|
| + syncer::PriorityUserTypes());
|
| if (!priority_types.Empty()) {
|
| const syncer::ConfigureReason reason = HasSyncSetupCompleted() ?
|
| syncer::CONFIGURE_REASON_RECONFIGURATION :
|
| @@ -1745,7 +1786,7 @@ void ProfileSyncService::ConfigureDataTypeManager() {
|
| base::Unretained(this))));
|
| }
|
|
|
| - const syncer::ModelTypeSet types = GetPreferredDataTypes();
|
| + const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
|
| syncer::ConfigureReason reason = syncer::CONFIGURE_REASON_UNKNOWN;
|
| if (!HasSyncSetupCompleted()) {
|
| reason = syncer::CONFIGURE_REASON_NEW_CLIENT;
|
| @@ -1862,6 +1903,9 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const {
|
| } else if (throttled_types.Has(type)) {
|
| type_status->SetString("status", "warning");
|
| type_status->SetString("value", "Throttled");
|
| + } else if (GetRegisteredNonBlockingDataTypes().Has(type)) {
|
| + type_status->SetString("status", "ok");
|
| + type_status->SetString("value", "Non-Blocking");
|
| } else if (active_types.Has(type)) {
|
| type_status->SetString("status", "ok");
|
| type_status->SetString("value", "Active: " +
|
|
|