| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #include "content/public/browser/notification_service.h" | 78 #include "content/public/browser/notification_service.h" |
| 79 #include "content/public/browser/notification_source.h" | 79 #include "content/public/browser/notification_source.h" |
| 80 #include "grit/generated_resources.h" | 80 #include "grit/generated_resources.h" |
| 81 #include "net/cookies/cookie_monster.h" | 81 #include "net/cookies/cookie_monster.h" |
| 82 #include "net/url_request/url_request_context_getter.h" | 82 #include "net/url_request/url_request_context_getter.h" |
| 83 #include "sync/api/sync_error.h" | 83 #include "sync/api/sync_error.h" |
| 84 #include "sync/internal_api/public/configure_reason.h" | 84 #include "sync/internal_api/public/configure_reason.h" |
| 85 #include "sync/internal_api/public/http_bridge_network_resources.h" | 85 #include "sync/internal_api/public/http_bridge_network_resources.h" |
| 86 #include "sync/internal_api/public/network_resources.h" | 86 #include "sync/internal_api/public/network_resources.h" |
| 87 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" | 87 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" |
| 88 #include "sync/internal_api/public/sync_core_proxy.h" | 88 #include "sync/internal_api/public/sync_context_proxy.h" |
| 89 #include "sync/internal_api/public/sync_encryption_handler.h" | 89 #include "sync/internal_api/public/sync_encryption_handler.h" |
| 90 #include "sync/internal_api/public/util/experiments.h" | 90 #include "sync/internal_api/public/util/experiments.h" |
| 91 #include "sync/internal_api/public/util/sync_string_conversions.h" | 91 #include "sync/internal_api/public/util/sync_string_conversions.h" |
| 92 #include "sync/js/js_event_details.h" | 92 #include "sync/js/js_event_details.h" |
| 93 #include "sync/util/cryptographer.h" | 93 #include "sync/util/cryptographer.h" |
| 94 #include "ui/base/l10n/l10n_util.h" | 94 #include "ui/base/l10n/l10n_util.h" |
| 95 #include "ui/base/l10n/time_format.h" | 95 #include "ui/base/l10n/time_format.h" |
| 96 | 96 |
| 97 #if defined(OS_ANDROID) | 97 #if defined(OS_ANDROID) |
| 98 #include "sync/internal_api/public/read_transaction.h" | 98 #include "sync/internal_api/public/read_transaction.h" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 << "Duplicate registration of type " << ModelTypeToString(type); | 390 << "Duplicate registration of type " << ModelTypeToString(type); |
| 391 | 391 |
| 392 // TODO(rlarocque): Set the enable flag properly when crbug.com/368834 is | 392 // TODO(rlarocque): Set the enable flag properly when crbug.com/368834 is |
| 393 // fixed and we have some way of telling whether or not this type should be | 393 // fixed and we have some way of telling whether or not this type should be |
| 394 // enabled. | 394 // enabled. |
| 395 non_blocking_data_type_manager_.RegisterType(type, false); | 395 non_blocking_data_type_manager_.RegisterType(type, false); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void ProfileSyncService::InitializeNonBlockingType( | 398 void ProfileSyncService::InitializeNonBlockingType( |
| 399 syncer::ModelType type, | 399 syncer::ModelType type, |
| 400 scoped_refptr<base::SequencedTaskRunner> task_runner, | 400 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 401 base::WeakPtr<syncer::NonBlockingTypeProcessor> processor) { | 401 const base::WeakPtr<syncer::ModelTypeSyncProxyImpl>& type_sync_proxy) { |
| 402 non_blocking_data_type_manager_.InitializeTypeProcessor( | 402 non_blocking_data_type_manager_.InitializeType( |
| 403 type, | 403 type, task_runner, type_sync_proxy); |
| 404 task_runner, | |
| 405 processor); | |
| 406 } | 404 } |
| 407 | 405 |
| 408 bool ProfileSyncService::IsSessionsDataTypeControllerRunning() const { | 406 bool ProfileSyncService::IsSessionsDataTypeControllerRunning() const { |
| 409 return directory_data_type_controllers_.find(syncer::SESSIONS) != | 407 return directory_data_type_controllers_.find(syncer::SESSIONS) != |
| 410 directory_data_type_controllers_.end() && | 408 directory_data_type_controllers_.end() && |
| 411 (directory_data_type_controllers_.find(syncer::SESSIONS)-> | 409 (directory_data_type_controllers_.find(syncer::SESSIONS)-> |
| 412 second->state() == DataTypeController::RUNNING); | 410 second->state() == DataTypeController::RUNNING); |
| 413 } | 411 } |
| 414 | 412 |
| 415 browser_sync::OpenTabsUIDelegate* ProfileSyncService::GetOpenTabsUIDelegate() { | 413 browser_sync::OpenTabsUIDelegate* ProfileSyncService::GetOpenTabsUIDelegate() { |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 | 1007 |
| 1010 void ProfileSyncService::PostBackendInitialization() { | 1008 void ProfileSyncService::PostBackendInitialization() { |
| 1011 // Never get here for backup / restore. | 1009 // Never get here for backup / restore. |
| 1012 DCHECK_EQ(backend_mode_, SYNC); | 1010 DCHECK_EQ(backend_mode_, SYNC); |
| 1013 | 1011 |
| 1014 if (protocol_event_observers_.might_have_observers()) { | 1012 if (protocol_event_observers_.might_have_observers()) { |
| 1015 backend_->RequestBufferedProtocolEventsAndEnableForwarding(); | 1013 backend_->RequestBufferedProtocolEventsAndEnableForwarding(); |
| 1016 } | 1014 } |
| 1017 | 1015 |
| 1018 non_blocking_data_type_manager_.ConnectSyncBackend( | 1016 non_blocking_data_type_manager_.ConnectSyncBackend( |
| 1019 backend_->GetSyncCoreProxy()); | 1017 backend_->GetSyncContextProxy()); |
| 1020 | 1018 |
| 1021 if (type_debug_info_observers_.might_have_observers()) { | 1019 if (type_debug_info_observers_.might_have_observers()) { |
| 1022 backend_->EnableDirectoryTypeDebugInfoForwarding(); | 1020 backend_->EnableDirectoryTypeDebugInfoForwarding(); |
| 1023 } | 1021 } |
| 1024 | 1022 |
| 1025 // If we have a cached passphrase use it to decrypt/encrypt data now that the | 1023 // If we have a cached passphrase use it to decrypt/encrypt data now that the |
| 1026 // backend is initialized. We want to call this before notifying observers in | 1024 // backend is initialized. We want to call this before notifying observers in |
| 1027 // case this operation affects the "passphrase required" status. | 1025 // case this operation affects the "passphrase required" status. |
| 1028 ConsumeCachedPassphraseIfPossible(); | 1026 ConsumeCachedPassphraseIfPossible(); |
| 1029 | 1027 |
| (...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 if (custom_sync_url.is_valid()) { | 2566 if (custom_sync_url.is_valid()) { |
| 2569 result = custom_sync_url; | 2567 result = custom_sync_url; |
| 2570 } else { | 2568 } else { |
| 2571 LOG(WARNING) << "The following sync URL specified at the command-line " | 2569 LOG(WARNING) << "The following sync URL specified at the command-line " |
| 2572 << "is invalid: " << value; | 2570 << "is invalid: " << value; |
| 2573 } | 2571 } |
| 2574 } | 2572 } |
| 2575 } | 2573 } |
| 2576 return result; | 2574 return result; |
| 2577 } | 2575 } |
| OLD | NEW |