| 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 "components/browser_sync/profile_sync_service.h" | 5 #include "components/browser_sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 blocking_task_runner_); | 934 blocking_task_runner_); |
| 935 | 935 |
| 936 if (protocol_event_observers_.might_have_observers()) { | 936 if (protocol_event_observers_.might_have_observers()) { |
| 937 engine_->RequestBufferedProtocolEventsAndEnableForwarding(); | 937 engine_->RequestBufferedProtocolEventsAndEnableForwarding(); |
| 938 } | 938 } |
| 939 | 939 |
| 940 if (type_debug_info_observers_.might_have_observers()) { | 940 if (type_debug_info_observers_.might_have_observers()) { |
| 941 engine_->EnableDirectoryTypeDebugInfoForwarding(); | 941 engine_->EnableDirectoryTypeDebugInfoForwarding(); |
| 942 } | 942 } |
| 943 | 943 |
| 944 // If we have a cached passphrase use it to decrypt/encrypt data now that the | |
| 945 // backend is initialized. We want to call this before notifying observers in | |
| 946 // case this operation affects the "passphrase required" status. | |
| 947 crypto_->ConsumeCachedPassphraseIfPossible(); | |
| 948 | |
| 949 // The very first time the backend initializes is effectively the first time | 944 // The very first time the backend initializes is effectively the first time |
| 950 // we can say we successfully "synced". LastSyncedTime will only be null in | 945 // we can say we successfully "synced". LastSyncedTime will only be null in |
| 951 // this case, because the pref wasn't restored on StartUp. | 946 // this case, because the pref wasn't restored on StartUp. |
| 952 if (sync_prefs_.GetLastSyncedTime().is_null()) { | 947 if (sync_prefs_.GetLastSyncedTime().is_null()) { |
| 953 UpdateLastSyncedTime(); | 948 UpdateLastSyncedTime(); |
| 954 } | 949 } |
| 955 | 950 |
| 956 data_type_manager_.reset( | 951 data_type_manager_.reset( |
| 957 sync_client_->GetSyncApiComponentFactory()->CreateDataTypeManager( | 952 sync_client_->GetSyncApiComponentFactory()->CreateDataTypeManager( |
| 958 initial_types, debug_info_listener_, &data_type_controllers_, this, | 953 initial_types, debug_info_listener_, &data_type_controllers_, this, |
| 959 engine_.get(), this)); | 954 engine_.get(), this)); |
| 960 | 955 |
| 961 crypto_->SetSyncEngine(engine_.get()); | 956 crypto_->SetSyncEngine(engine_.get()); |
| 962 crypto_->SetDataTypeManager(data_type_manager_.get()); | 957 crypto_->SetDataTypeManager(data_type_manager_.get()); |
| 963 | 958 |
| 959 // If we have a cached passphrase use it to decrypt/encrypt data now that the |
| 960 // backend is initialized. We want to call this before notifying observers in |
| 961 // case this operation affects the "passphrase required" status. |
| 962 crypto_->ConsumeCachedPassphraseIfPossible(); |
| 963 |
| 964 // Auto-start means IsFirstSetupComplete gets set automatically. | 964 // Auto-start means IsFirstSetupComplete gets set automatically. |
| 965 if (start_behavior_ == AUTO_START && !IsFirstSetupComplete()) { | 965 if (start_behavior_ == AUTO_START && !IsFirstSetupComplete()) { |
| 966 // This will trigger a configure if it completes setup. | 966 // This will trigger a configure if it completes setup. |
| 967 SetFirstSetupComplete(); | 967 SetFirstSetupComplete(); |
| 968 } else if (CanConfigureDataTypes()) { | 968 } else if (CanConfigureDataTypes()) { |
| 969 ConfigureDataTypeManager(); | 969 ConfigureDataTypeManager(); |
| 970 } | 970 } |
| 971 | 971 |
| 972 // Check for a cookie jar mismatch. | 972 // Check for a cookie jar mismatch. |
| 973 std::vector<gaia::ListedAccount> accounts; | 973 std::vector<gaia::ListedAccount> accounts; |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2420 | 2420 |
| 2421 DCHECK(startup_controller_->IsSetupInProgress()); | 2421 DCHECK(startup_controller_->IsSetupInProgress()); |
| 2422 startup_controller_->SetSetupInProgress(false); | 2422 startup_controller_->SetSetupInProgress(false); |
| 2423 | 2423 |
| 2424 if (IsEngineInitialized()) | 2424 if (IsEngineInitialized()) |
| 2425 ReconfigureDatatypeManager(); | 2425 ReconfigureDatatypeManager(); |
| 2426 NotifyObservers(); | 2426 NotifyObservers(); |
| 2427 } | 2427 } |
| 2428 | 2428 |
| 2429 } // namespace browser_sync | 2429 } // namespace browser_sync |
| OLD | NEW |