Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 217183003: Add non-blocking sync code to ProfileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 #include "content/public/browser/notification_service.h" 72 #include "content/public/browser/notification_service.h"
73 #include "content/public/browser/notification_source.h" 73 #include "content/public/browser/notification_source.h"
74 #include "google_apis/gaia/gaia_constants.h" 74 #include "google_apis/gaia/gaia_constants.h"
75 #include "grit/generated_resources.h" 75 #include "grit/generated_resources.h"
76 #include "net/cookies/cookie_monster.h" 76 #include "net/cookies/cookie_monster.h"
77 #include "net/url_request/url_request_context_getter.h" 77 #include "net/url_request/url_request_context_getter.h"
78 #include "sync/api/sync_error.h" 78 #include "sync/api/sync_error.h"
79 #include "sync/internal_api/public/configure_reason.h" 79 #include "sync/internal_api/public/configure_reason.h"
80 #include "sync/internal_api/public/http_bridge_network_resources.h" 80 #include "sync/internal_api/public/http_bridge_network_resources.h"
81 #include "sync/internal_api/public/network_resources.h" 81 #include "sync/internal_api/public/network_resources.h"
82 #include "sync/internal_api/public/sync_core_proxy.h"
82 #include "sync/internal_api/public/sync_encryption_handler.h" 83 #include "sync/internal_api/public/sync_encryption_handler.h"
83 #include "sync/internal_api/public/util/experiments.h" 84 #include "sync/internal_api/public/util/experiments.h"
84 #include "sync/internal_api/public/util/sync_string_conversions.h" 85 #include "sync/internal_api/public/util/sync_string_conversions.h"
85 #include "sync/js/js_arg_list.h" 86 #include "sync/js/js_arg_list.h"
86 #include "sync/js/js_event_details.h" 87 #include "sync/js/js_event_details.h"
87 #include "sync/util/cryptographer.h" 88 #include "sync/util/cryptographer.h"
88 #include "ui/base/l10n/l10n_util.h" 89 #include "ui/base/l10n/l10n_util.h"
89 #include "ui/base/l10n/time_format.h" 90 #include "ui/base/l10n/time_format.h"
90 91
91 #if defined(ENABLE_MANAGED_USERS) 92 #if defined(ENABLE_MANAGED_USERS)
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 341
341 void ProfileSyncService::UnregisterAuthNotifications() { 342 void ProfileSyncService::UnregisterAuthNotifications() {
342 if (signin()) 343 if (signin())
343 signin()->RemoveObserver(this); 344 signin()->RemoveObserver(this);
344 oauth2_token_service_->RemoveObserver(this); 345 oauth2_token_service_->RemoveObserver(this);
345 } 346 }
346 347
347 void ProfileSyncService::RegisterDataTypeController( 348 void ProfileSyncService::RegisterDataTypeController(
348 DataTypeController* data_type_controller) { 349 DataTypeController* data_type_controller) {
349 DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U); 350 DCHECK_EQ(data_type_controllers_.count(data_type_controller->type()), 0U);
351 DCHECK(!GetRegisteredNonBlockingDataTypes().Has(
352 data_type_controller->type()));
350 data_type_controllers_[data_type_controller->type()] = 353 data_type_controllers_[data_type_controller->type()] =
351 data_type_controller; 354 data_type_controller;
352 } 355 }
353 356
357 void ProfileSyncService::RegisterNonBlockingType(syncer::ModelType type) {
358 DCHECK_EQ(data_type_controllers_.count(type), 0U);
359 DCHECK(!GetRegisteredNonBlockingDataTypes().Has(type));
360 off_thread_types_.Put(type);
Nicolas Zea 2014/04/02 23:19:05 Presumably this is where we could kick off the sta
rlarocque 2014/04/03 01:03:46 Nope, not here. Registration is something that sh
361 }
362
354 browser_sync::SessionModelAssociator* 363 browser_sync::SessionModelAssociator*
355 ProfileSyncService::GetSessionModelAssociatorDeprecated() { 364 ProfileSyncService::GetSessionModelAssociatorDeprecated() {
356 if (!IsSessionsDataTypeControllerRunning()) 365 if (!IsSessionsDataTypeControllerRunning())
357 return NULL; 366 return NULL;
358 367
359 // If we're using sessions V2, there's no model associator. 368 // If we're using sessions V2, there's no model associator.
360 if (sessions_sync_manager_.get()) 369 if (sessions_sync_manager_.get())
361 return NULL; 370 return NULL;
362 371
363 return static_cast<browser_sync::SessionDataTypeController*>( 372 return static_cast<browser_sync::SessionDataTypeController*>(
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 scoped_ptr<syncer::SyncManagerFactory>( 545 scoped_ptr<syncer::SyncManagerFactory>(
537 new syncer::SyncManagerFactory).Pass(), 546 new syncer::SyncManagerFactory).Pass(),
538 backend_unrecoverable_error_handler.Pass(), 547 backend_unrecoverable_error_handler.Pass(),
539 &browser_sync::ChromeReportUnrecoverableError, 548 &browser_sync::ChromeReportUnrecoverableError,
540 network_resources_.get()); 549 network_resources_.get());
541 } 550 }
542 551
543 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { 552 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const {
544 if (encryption_pending()) 553 if (encryption_pending())
545 return true; 554 return true;
546 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes(); 555 const syncer::ModelTypeSet preferred_types =
556 GetPreferredDirectoryDataTypes();
Nicolas Zea 2014/04/02 23:19:05 Why not GetPreferredDataTypes? Encryption isn't so
rlarocque 2014/04/03 01:03:46 Good point. Fixed.
547 const syncer::ModelTypeSet encrypted_types = GetEncryptedDataTypes(); 557 const syncer::ModelTypeSet encrypted_types = GetEncryptedDataTypes();
548 DCHECK(encrypted_types.Has(syncer::PASSWORDS)); 558 DCHECK(encrypted_types.Has(syncer::PASSWORDS));
549 return !Intersection(preferred_types, encrypted_types).Empty(); 559 return !Intersection(preferred_types, encrypted_types).Empty();
550 } 560 }
551 561
552 void ProfileSyncService::OnSyncConfigureRetry() { 562 void ProfileSyncService::OnSyncConfigureRetry() {
553 // Note: in order to handle auth failures that arise before the backend is 563 // Note: in order to handle auth failures that arise before the backend is
554 // initialized (e.g. from invalidation notifier, or downloading new control 564 // initialized (e.g. from invalidation notifier, or downloading new control
555 // types), we have to gracefully handle configuration retries at all times. 565 // types), we have to gracefully handle configuration retries at all times.
556 // At this point an auth error badge should be shown, which once resolved 566 // At this point an auth error badge should be shown, which once resolved
(...skipping 10 matching lines...) Expand all
567 577
568 void ProfileSyncService::OnDataTypeRequestsSyncStartup( 578 void ProfileSyncService::OnDataTypeRequestsSyncStartup(
569 syncer::ModelType type) { 579 syncer::ModelType type) {
570 DCHECK(syncer::UserTypes().Has(type)); 580 DCHECK(syncer::UserTypes().Has(type));
571 if (backend_.get()) { 581 if (backend_.get()) {
572 DVLOG(1) << "A data type requested sync startup, but it looks like " 582 DVLOG(1) << "A data type requested sync startup, but it looks like "
573 "something else beat it to the punch."; 583 "something else beat it to the punch.";
574 return; 584 return;
575 } 585 }
576 586
577 if (!GetPreferredDataTypes().Has(type)) { 587 if (!GetPreferredDirectoryDataTypes().Has(type)) {
Nicolas Zea 2014/04/02 23:19:05 Here too. If a nonblocking type requests sync star
rlarocque 2014/04/03 01:03:46 Maybe. The non-blocking types won't be as badly a
578 // We can get here as datatype SyncableServices are typically wired up 588 // We can get here as datatype SyncableServices are typically wired up
579 // to the native datatype even if sync isn't enabled. 589 // to the native datatype even if sync isn't enabled.
580 DVLOG(1) << "Dropping sync startup request because type " 590 DVLOG(1) << "Dropping sync startup request because type "
581 << syncer::ModelTypeToString(type) << "not enabled."; 591 << syncer::ModelTypeToString(type) << "not enabled.";
582 return; 592 return;
583 } 593 }
584 594
585 startup_controller_.OnDataTypeRequestsSyncStartup(type); 595 startup_controller_.OnDataTypeRequestsSyncStartup(type);
586 } 596 }
587 597
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 // directory. It would be no big deal if we tried to delete it again. 939 // directory. It would be no big deal if we tried to delete it again.
930 OnInternalUnrecoverableError(FROM_HERE, 940 OnInternalUnrecoverableError(FROM_HERE,
931 "BackendInitialize failure", 941 "BackendInitialize failure",
932 false, 942 false,
933 ERROR_REASON_BACKEND_INIT_FAILURE); 943 ERROR_REASON_BACKEND_INIT_FAILURE);
934 return; 944 return;
935 } 945 }
936 946
937 backend_initialized_ = true; 947 backend_initialized_ = true;
938 948
949 backend_->SetPreferredNonBlockingTypes(GetPreferredNonBlockingDataTypes());
Nicolas Zea 2014/04/02 23:19:05 It's not clear to me why the backend needs to know
rlarocque 2014/04/03 01:03:46 I was surprised to learn about this, too. We want
Nicolas Zea 2014/04/03 17:52:15 But why is this different from directory types? Do
rlarocque 2014/04/03 19:57:03 Directory types register for invalidations once th
950
939 sync_js_controller_.AttachJsBackend(js_backend); 951 sync_js_controller_.AttachJsBackend(js_backend);
940 debug_info_listener_ = debug_info_listener; 952 debug_info_listener_ = debug_info_listener;
941 953
942 if (protocol_event_observers_.might_have_observers()) { 954 if (protocol_event_observers_.might_have_observers()) {
943 backend_->SetForwardProtocolEvents(true); 955 backend_->SetForwardProtocolEvents(true);
944 } 956 }
945 957
958 syncer::SyncCoreProxy sync_core_proxy_ = backend_->GetSyncCoreProxy();
959
946 // If we have a cached passphrase use it to decrypt/encrypt data now that the 960 // If we have a cached passphrase use it to decrypt/encrypt data now that the
947 // backend is initialized. We want to call this before notifying observers in 961 // backend is initialized. We want to call this before notifying observers in
948 // case this operation affects the "passphrase required" status. 962 // case this operation affects the "passphrase required" status.
949 ConsumeCachedPassphraseIfPossible(); 963 ConsumeCachedPassphraseIfPossible();
950 964
951 // The very first time the backend initializes is effectively the first time 965 // The very first time the backend initializes is effectively the first time
952 // we can say we successfully "synced". last_synced_time_ will only be null 966 // we can say we successfully "synced". last_synced_time_ will only be null
953 // in this case, because the pref wasn't restored on StartUp. 967 // in this case, because the pref wasn't restored on StartUp.
954 if (last_synced_time_.is_null()) { 968 if (last_synced_time_.is_null()) {
955 UpdateLastSyncedTime(); 969 UpdateLastSyncedTime();
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 if (HasUnrecoverableError()) { 1224 if (HasUnrecoverableError()) {
1211 // When unrecoverable error is detected we post a task to shutdown the 1225 // When unrecoverable error is detected we post a task to shutdown the
1212 // backend. The task might not have executed yet. 1226 // backend. The task might not have executed yet.
1213 return; 1227 return;
1214 } 1228 }
1215 1229
1216 DVLOG(1) << "Passphrase required with reason: " 1230 DVLOG(1) << "Passphrase required with reason: "
1217 << syncer::PassphraseRequiredReasonToString(reason); 1231 << syncer::PassphraseRequiredReasonToString(reason);
1218 passphrase_required_reason_ = reason; 1232 passphrase_required_reason_ = reason;
1219 1233
1220 const syncer::ModelTypeSet types = GetPreferredDataTypes(); 1234 const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
1221 if (data_type_manager_) { 1235 if (data_type_manager_) {
1222 // Reconfigure without the encrypted types (excluded implicitly via the 1236 // Reconfigure without the encrypted types (excluded implicitly via the
1223 // failed datatypes handler). 1237 // failed datatypes handler).
1224 data_type_manager_->Configure(types, 1238 data_type_manager_->Configure(types,
1225 syncer::CONFIGURE_REASON_CRYPTO); 1239 syncer::CONFIGURE_REASON_CRYPTO);
1226 } 1240 }
1227 1241
1228 // Notify observers that the passphrase status may have changed. 1242 // Notify observers that the passphrase status may have changed.
1229 NotifyObservers(); 1243 NotifyObservers();
1230 } 1244 }
1231 1245
1232 void ProfileSyncService::OnPassphraseAccepted() { 1246 void ProfileSyncService::OnPassphraseAccepted() {
1233 DVLOG(1) << "Received OnPassphraseAccepted."; 1247 DVLOG(1) << "Received OnPassphraseAccepted.";
1234 1248
1235 // If the pending keys were resolved via keystore, it's possible we never 1249 // If the pending keys were resolved via keystore, it's possible we never
1236 // consumed our cached passphrase. Clear it now. 1250 // consumed our cached passphrase. Clear it now.
1237 if (!cached_passphrase_.empty()) 1251 if (!cached_passphrase_.empty())
1238 cached_passphrase_.clear(); 1252 cached_passphrase_.clear();
1239 1253
1240 // Reset passphrase_required_reason_ since we know we no longer require the 1254 // Reset passphrase_required_reason_ since we know we no longer require the
1241 // passphrase. We do this here rather than down in ResolvePassphraseRequired() 1255 // passphrase. We do this here rather than down in ResolvePassphraseRequired()
1242 // because that can be called by OnPassphraseRequired() if no encrypted data 1256 // because that can be called by OnPassphraseRequired() if no encrypted data
1243 // types are enabled, and we don't want to clobber the true passphrase error. 1257 // types are enabled, and we don't want to clobber the true passphrase error.
1244 passphrase_required_reason_ = syncer::REASON_PASSPHRASE_NOT_REQUIRED; 1258 passphrase_required_reason_ = syncer::REASON_PASSPHRASE_NOT_REQUIRED;
1245 1259
1246 // Make sure the data types that depend on the passphrase are started at 1260 // Make sure the data types that depend on the passphrase are started at
1247 // this time. 1261 // this time.
1248 const syncer::ModelTypeSet types = GetPreferredDataTypes(); 1262 const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
1249 if (data_type_manager_) { 1263 if (data_type_manager_) {
1250 // Re-enable any encrypted types if necessary. 1264 // Re-enable any encrypted types if necessary.
1251 data_type_manager_->Configure(types, 1265 data_type_manager_->Configure(types,
1252 syncer::CONFIGURE_REASON_CRYPTO); 1266 syncer::CONFIGURE_REASON_CRYPTO);
1253 } 1267 }
1254 1268
1255 NotifyObservers(); 1269 NotifyObservers();
1256 } 1270 }
1257 1271
1258 void ProfileSyncService::OnEncryptedTypesChanged( 1272 void ProfileSyncService::OnEncryptedTypesChanged(
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 void ProfileSyncService::ChangePreferredDataTypes( 1667 void ProfileSyncService::ChangePreferredDataTypes(
1654 syncer::ModelTypeSet preferred_types) { 1668 syncer::ModelTypeSet preferred_types) {
1655 1669
1656 DVLOG(1) << "ChangePreferredDataTypes invoked"; 1670 DVLOG(1) << "ChangePreferredDataTypes invoked";
1657 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); 1671 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes();
1658 const syncer::ModelTypeSet registered_preferred_types = 1672 const syncer::ModelTypeSet registered_preferred_types =
1659 Intersection(registered_types, preferred_types); 1673 Intersection(registered_types, preferred_types);
1660 sync_prefs_.SetPreferredDataTypes(registered_types, 1674 sync_prefs_.SetPreferredDataTypes(registered_types,
1661 registered_preferred_types); 1675 registered_preferred_types);
1662 1676
1677 if (backend_.get() && backend_initialized_)
1678 backend_->SetPreferredNonBlockingTypes(GetPreferredNonBlockingDataTypes());
1679
1663 // Now reconfigure the DTM. 1680 // Now reconfigure the DTM.
1664 ReconfigureDatatypeManager(); 1681 ReconfigureDatatypeManager();
1665 } 1682 }
1666 1683
1667 syncer::ModelTypeSet ProfileSyncService::GetActiveDataTypes() const { 1684 syncer::ModelTypeSet ProfileSyncService::GetActiveDataTypes() const {
1668 const syncer::ModelTypeSet preferred_types = GetPreferredDataTypes(); 1685 const syncer::ModelTypeSet preferred_types = GetPreferredDirectoryDataTypes();
Nicolas Zea 2014/04/02 23:19:05 ActiveTypes only cares about whether they're runni
rlarocque 2014/04/03 01:03:46 I thought this was used only for construction of t
Nicolas Zea 2014/04/03 17:52:15 Anything that cares about what types are actually
1669 const syncer::ModelTypeSet failed_types = 1686 const syncer::ModelTypeSet failed_types =
1670 failed_data_types_handler_.GetFailedTypes(); 1687 failed_data_types_handler_.GetFailedTypes();
1671 return Difference(preferred_types, failed_types); 1688 return Difference(preferred_types, failed_types);
1672 } 1689 }
1673 1690
1674 syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const { 1691 syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const {
1675 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes(); 1692 const syncer::ModelTypeSet registered_types = GetRegisteredDataTypes();
1676 const syncer::ModelTypeSet preferred_types = 1693 const syncer::ModelTypeSet preferred_types =
1677 sync_prefs_.GetPreferredDataTypes(registered_types); 1694 sync_prefs_.GetPreferredDataTypes(registered_types);
1678 return preferred_types; 1695 return preferred_types;
1679 } 1696 }
1680 1697
1698 syncer::ModelTypeSet
1699 ProfileSyncService::GetPreferredDirectoryDataTypes() const {
1700 const syncer::ModelTypeSet registered_directory_types =
1701 GetRegisteredDirectoryDataTypes();
1702 const syncer::ModelTypeSet preferred_types =
1703 sync_prefs_.GetPreferredDataTypes(registered_directory_types);
1704 return preferred_types;
1705 }
1706
1707 syncer::ModelTypeSet
1708 ProfileSyncService::GetPreferredNonBlockingDataTypes() const {
1709 return sync_prefs_.GetPreferredDataTypes(GetRegisteredNonBlockingDataTypes());
1710 }
1711
1681 syncer::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const { 1712 syncer::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const {
1713 return Union(GetRegisteredDirectoryDataTypes(),
1714 GetRegisteredNonBlockingDataTypes());
1715 }
1716
1717 syncer::ModelTypeSet
1718 ProfileSyncService::GetRegisteredDirectoryDataTypes() const {
1682 syncer::ModelTypeSet registered_types; 1719 syncer::ModelTypeSet registered_types;
1683 // The data_type_controllers_ are determined by command-line flags; that's 1720 // The data_type_controllers_ are determined by command-line flags; that's
1684 // effectively what controls the values returned here. 1721 // effectively what controls the values returned here.
1685 for (DataTypeController::TypeMap::const_iterator it = 1722 for (DataTypeController::TypeMap::const_iterator it =
1686 data_type_controllers_.begin(); 1723 data_type_controllers_.begin();
1687 it != data_type_controllers_.end(); ++it) { 1724 it != data_type_controllers_.end(); ++it) {
1688 registered_types.Put(it->first); 1725 registered_types.Put(it->first);
1689 } 1726 }
1690 return registered_types; 1727 return registered_types;
1691 } 1728 }
1692 1729
1730 syncer::ModelTypeSet
1731 ProfileSyncService::GetRegisteredNonBlockingDataTypes() const {
1732 return off_thread_types_;
1733 }
1734
1693 bool ProfileSyncService::IsUsingSecondaryPassphrase() const { 1735 bool ProfileSyncService::IsUsingSecondaryPassphrase() const {
1694 syncer::PassphraseType passphrase_type = GetPassphraseType(); 1736 syncer::PassphraseType passphrase_type = GetPassphraseType();
1695 return passphrase_type == syncer::FROZEN_IMPLICIT_PASSPHRASE || 1737 return passphrase_type == syncer::FROZEN_IMPLICIT_PASSPHRASE ||
1696 passphrase_type == syncer::CUSTOM_PASSPHRASE; 1738 passphrase_type == syncer::CUSTOM_PASSPHRASE;
1697 } 1739 }
1698 1740
1699 syncer::PassphraseType ProfileSyncService::GetPassphraseType() const { 1741 syncer::PassphraseType ProfileSyncService::GetPassphraseType() const {
1700 return backend_->GetPassphraseType(); 1742 return backend_->GetPassphraseType();
1701 } 1743 }
1702 1744
1703 base::Time ProfileSyncService::GetExplicitPassphraseTime() const { 1745 base::Time ProfileSyncService::GetExplicitPassphraseTime() const {
1704 return backend_->GetExplicitPassphraseTime(); 1746 return backend_->GetExplicitPassphraseTime();
1705 } 1747 }
1706 1748
1707 bool ProfileSyncService::IsCryptographerReady( 1749 bool ProfileSyncService::IsCryptographerReady(
1708 const syncer::BaseTransaction* trans) const { 1750 const syncer::BaseTransaction* trans) const {
1709 return backend_.get() && backend_->IsCryptographerReady(trans); 1751 return backend_.get() && backend_->IsCryptographerReady(trans);
1710 } 1752 }
1711 1753
1712 void ProfileSyncService::ConfigurePriorityDataTypes() { 1754 void ProfileSyncService::ConfigurePriorityDataTypes() {
1713 const syncer::ModelTypeSet priority_types = 1755 const syncer::ModelTypeSet priority_types =
1714 Intersection(GetPreferredDataTypes(), syncer::PriorityUserTypes()); 1756 Intersection(GetPreferredDirectoryDataTypes(),
1757 syncer::PriorityUserTypes());
1715 if (!priority_types.Empty()) { 1758 if (!priority_types.Empty()) {
1716 const syncer::ConfigureReason reason = HasSyncSetupCompleted() ? 1759 const syncer::ConfigureReason reason = HasSyncSetupCompleted() ?
1717 syncer::CONFIGURE_REASON_RECONFIGURATION : 1760 syncer::CONFIGURE_REASON_RECONFIGURATION :
1718 syncer::CONFIGURE_REASON_NEW_CLIENT; 1761 syncer::CONFIGURE_REASON_NEW_CLIENT;
1719 data_type_manager_->Configure(priority_types, reason); 1762 data_type_manager_->Configure(priority_types, reason);
1720 } 1763 }
1721 } 1764 }
1722 1765
1723 void ProfileSyncService::ConfigureDataTypeManager() { 1766 void ProfileSyncService::ConfigureDataTypeManager() {
1724 // Don't configure datatypes if the setup UI is still on the screen - this 1767 // Don't configure datatypes if the setup UI is still on the screen - this
(...skipping 17 matching lines...) Expand all
1742 1785
1743 // We create the migrator at the same time. 1786 // We create the migrator at the same time.
1744 migrator_.reset( 1787 migrator_.reset(
1745 new browser_sync::BackendMigrator( 1788 new browser_sync::BackendMigrator(
1746 profile_->GetDebugName(), GetUserShare(), 1789 profile_->GetDebugName(), GetUserShare(),
1747 this, data_type_manager_.get(), 1790 this, data_type_manager_.get(),
1748 base::Bind(&ProfileSyncService::StartSyncingWithServer, 1791 base::Bind(&ProfileSyncService::StartSyncingWithServer,
1749 base::Unretained(this)))); 1792 base::Unretained(this))));
1750 } 1793 }
1751 1794
1752 const syncer::ModelTypeSet types = GetPreferredDataTypes(); 1795 const syncer::ModelTypeSet types = GetPreferredDirectoryDataTypes();
1753 syncer::ConfigureReason reason = syncer::CONFIGURE_REASON_UNKNOWN; 1796 syncer::ConfigureReason reason = syncer::CONFIGURE_REASON_UNKNOWN;
1754 if (!HasSyncSetupCompleted()) { 1797 if (!HasSyncSetupCompleted()) {
1755 reason = syncer::CONFIGURE_REASON_NEW_CLIENT; 1798 reason = syncer::CONFIGURE_REASON_NEW_CLIENT;
1756 } else if (restart) { 1799 } else if (restart) {
1757 // Datatype downloads on restart are generally due to newly supported 1800 // Datatype downloads on restart are generally due to newly supported
1758 // datatypes (although it's also possible we're picking up where a failed 1801 // datatypes (although it's also possible we're picking up where a failed
1759 // previous configuration left off). 1802 // previous configuration left off).
1760 // TODO(sync): consider detecting configuration recovery and setting 1803 // TODO(sync): consider detecting configuration recovery and setting
1761 // the reason here appropriately. 1804 // the reason here appropriately.
1762 reason = syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE; 1805 reason = syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 type_status->SetString("value", error_text); 1902 type_status->SetString("value", error_text);
1860 } else if (throttled_types.Has(type) && passive_types.Has(type)) { 1903 } else if (throttled_types.Has(type) && passive_types.Has(type)) {
1861 type_status->SetString("status", "warning"); 1904 type_status->SetString("status", "warning");
1862 type_status->SetString("value", "Passive, Throttled"); 1905 type_status->SetString("value", "Passive, Throttled");
1863 } else if (passive_types.Has(type)) { 1906 } else if (passive_types.Has(type)) {
1864 type_status->SetString("status", "warning"); 1907 type_status->SetString("status", "warning");
1865 type_status->SetString("value", "Passive"); 1908 type_status->SetString("value", "Passive");
1866 } else if (throttled_types.Has(type)) { 1909 } else if (throttled_types.Has(type)) {
1867 type_status->SetString("status", "warning"); 1910 type_status->SetString("status", "warning");
1868 type_status->SetString("value", "Throttled"); 1911 type_status->SetString("value", "Throttled");
1912 } else if (GetRegisteredNonBlockingDataTypes().Has(type)) {
1913 type_status->SetString("status", "ok");
1914 type_status->SetString("value", "Non-Blocking");
1869 } else if (active_types.Has(type)) { 1915 } else if (active_types.Has(type)) {
1870 type_status->SetString("status", "ok"); 1916 type_status->SetString("status", "ok");
1871 type_status->SetString("value", "Active: " + 1917 type_status->SetString("value", "Active: " +
1872 ModelSafeGroupToString(routing_info[type])); 1918 ModelSafeGroupToString(routing_info[type]));
1873 } else { 1919 } else {
1874 type_status->SetString("status", "warning"); 1920 type_status->SetString("status", "warning");
1875 type_status->SetString("value", "Disabled by User"); 1921 type_status->SetString("value", "Disabled by User");
1876 } 1922 }
1877 1923
1878 int live_count = detailed_status.num_entries_by_type[type] - 1924 int live_count = detailed_status.num_entries_by_type[type] -
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 status.last_get_token_error = last_get_token_error_; 2267 status.last_get_token_error = last_get_token_error_;
2222 if (request_access_token_retry_timer_.IsRunning()) 2268 if (request_access_token_retry_timer_.IsRunning())
2223 status.next_token_request_time = next_token_request_time_; 2269 status.next_token_request_time = next_token_request_time_;
2224 return status; 2270 return status;
2225 } 2271 }
2226 2272
2227 void ProfileSyncService::OverrideNetworkResourcesForTest( 2273 void ProfileSyncService::OverrideNetworkResourcesForTest(
2228 scoped_ptr<syncer::NetworkResources> network_resources) { 2274 scoped_ptr<syncer::NetworkResources> network_resources) {
2229 network_resources_ = network_resources.Pass(); 2275 network_resources_ = network_resources.Pass();
2230 } 2276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698