OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sync/driver/glue/sync_backend_host_impl.h" | 5 #include "components/sync/driver/glue/sync_backend_host_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 invalidation::InvalidationService* invalidator, | 52 invalidation::InvalidationService* invalidator, |
53 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, | 53 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, |
54 const base::FilePath& sync_folder) | 54 const base::FilePath& sync_folder) |
55 : frontend_task_runner_(base::ThreadTaskRunnerHandle::Get()), | 55 : frontend_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
56 sync_client_(sync_client), | 56 sync_client_(sync_client), |
57 ui_thread_(ui_thread), | 57 ui_thread_(ui_thread), |
58 name_(name), | 58 name_(name), |
59 initialized_(false), | 59 initialized_(false), |
60 sync_prefs_(sync_prefs), | 60 sync_prefs_(sync_prefs), |
61 frontend_(NULL), | 61 frontend_(NULL), |
62 cached_passphrase_type_(syncer::IMPLICIT_PASSPHRASE), | 62 cached_passphrase_type_(syncer::PassphraseType::IMPLICIT_PASSPHRASE), |
63 invalidator_(invalidator), | 63 invalidator_(invalidator), |
64 invalidation_handler_registered_(false), | 64 invalidation_handler_registered_(false), |
65 weak_ptr_factory_(this) { | 65 weak_ptr_factory_(this) { |
66 core_ = new SyncBackendHostCore(name_, sync_folder, | 66 core_ = new SyncBackendHostCore(name_, sync_folder, |
67 sync_prefs_->IsFirstSetupComplete(), | 67 sync_prefs_->IsFirstSetupComplete(), |
68 weak_ptr_factory_.GetWeakPtr()); | 68 weak_ptr_factory_.GetWeakPtr()); |
69 } | 69 } |
70 | 70 |
71 SyncBackendHostImpl::~SyncBackendHostImpl() { | 71 SyncBackendHostImpl::~SyncBackendHostImpl() { |
72 DCHECK(!core_.get() && !frontend_) << "Must call Shutdown before destructor."; | 72 DCHECK(!core_.get() && !frontend_) << "Must call Shutdown before destructor."; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 | 171 |
172 // We should never be called with an empty passphrase. | 172 // We should never be called with an empty passphrase. |
173 DCHECK(!passphrase.empty()); | 173 DCHECK(!passphrase.empty()); |
174 | 174 |
175 // This should only be called by the frontend. | 175 // This should only be called by the frontend. |
176 DCHECK(frontend_task_runner_->BelongsToCurrentThread()); | 176 DCHECK(frontend_task_runner_->BelongsToCurrentThread()); |
177 | 177 |
178 // SetEncryptionPassphrase should never be called if we are currently | 178 // SetEncryptionPassphrase should never be called if we are currently |
179 // encrypted with an explicit passphrase. | 179 // encrypted with an explicit passphrase. |
180 DCHECK(cached_passphrase_type_ == syncer::KEYSTORE_PASSPHRASE || | 180 DCHECK( |
181 cached_passphrase_type_ == syncer::IMPLICIT_PASSPHRASE); | 181 cached_passphrase_type_ == syncer::PassphraseType::KEYSTORE_PASSPHRASE || |
| 182 cached_passphrase_type_ == syncer::PassphraseType::IMPLICIT_PASSPHRASE); |
182 | 183 |
183 // Post an encryption task on the syncer thread. | 184 // Post an encryption task on the syncer thread. |
184 registrar_->sync_thread()->task_runner()->PostTask( | 185 registrar_->sync_thread()->task_runner()->PostTask( |
185 FROM_HERE, base::Bind(&SyncBackendHostCore::DoSetEncryptionPassphrase, | 186 FROM_HERE, base::Bind(&SyncBackendHostCore::DoSetEncryptionPassphrase, |
186 core_.get(), passphrase, is_explicit)); | 187 core_.get(), passphrase, is_explicit)); |
187 } | 188 } |
188 | 189 |
189 bool SyncBackendHostImpl::SetDecryptionPassphrase( | 190 bool SyncBackendHostImpl::SetDecryptionPassphrase( |
190 const std::string& passphrase) { | 191 const std::string& passphrase) { |
191 if (!IsNigoriEnabled()) { | 192 if (!IsNigoriEnabled()) { |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { | 851 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { |
851 DCHECK(ui_thread_->BelongsToCurrentThread()); | 852 DCHECK(ui_thread_->BelongsToCurrentThread()); |
852 frontend_callback.Run(); | 853 frontend_callback.Run(); |
853 } | 854 } |
854 | 855 |
855 } // namespace browser_sync | 856 } // namespace browser_sync |
856 | 857 |
857 #undef SDVLOG | 858 #undef SDVLOG |
858 | 859 |
859 #undef SLOG | 860 #undef SLOG |
OLD | NEW |