OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/file_version_info.h" | 8 #include "base/file_version_info.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 bookmark_model_worker_ = new BookmarkModelWorker(frontend_loop_); | 49 bookmark_model_worker_ = new BookmarkModelWorker(frontend_loop_); |
50 | 50 |
51 core_thread_.message_loop()->PostTask(FROM_HERE, | 51 core_thread_.message_loop()->PostTask(FROM_HERE, |
52 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoInitialize, | 52 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoInitialize, |
53 sync_service_url, bookmark_model_worker_, true, | 53 sync_service_url, bookmark_model_worker_, true, |
54 new HttpBridgeFactory(baseline_context_getter), | 54 new HttpBridgeFactory(baseline_context_getter), |
55 new HttpBridgeFactory(baseline_context_getter))); | 55 new HttpBridgeFactory(baseline_context_getter))); |
56 } | 56 } |
57 | 57 |
58 void SyncBackendHost::Authenticate(const std::string& username, | 58 void SyncBackendHost::Authenticate(const std::string& username, |
59 const std::string& password) { | 59 const std::string& password, |
| 60 const std::string& captcha) { |
60 core_thread_.message_loop()->PostTask(FROM_HERE, | 61 core_thread_.message_loop()->PostTask(FROM_HERE, |
61 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoAuthenticate, | 62 NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoAuthenticate, |
62 username, password)); | 63 username, password, captcha)); |
63 } | 64 } |
64 | 65 |
65 void SyncBackendHost::Shutdown(bool sync_disabled) { | 66 void SyncBackendHost::Shutdown(bool sync_disabled) { |
66 // Thread shutdown should occur in the following order: | 67 // Thread shutdown should occur in the following order: |
67 // - SyncerThread | 68 // - SyncerThread |
68 // - CoreThread | 69 // - CoreThread |
69 // - UI Thread (stops some time after we return from this call). | 70 // - UI Thread (stops some time after we return from this call). |
70 core_thread_.message_loop()->PostTask(FROM_HERE, | 71 core_thread_.message_loop()->PostTask(FROM_HERE, |
71 NewRunnableMethod(core_.get(), | 72 NewRunnableMethod(core_.get(), |
72 &SyncBackendHost::Core::DoShutdown, | 73 &SyncBackendHost::Core::DoShutdown, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 service_url.SchemeIsSecure(), | 187 service_url.SchemeIsSecure(), |
187 http_provider_factory, | 188 http_provider_factory, |
188 auth_http_provider_factory, | 189 auth_http_provider_factory, |
189 bookmark_model_worker, | 190 bookmark_model_worker, |
190 attempt_last_user_authentication, | 191 attempt_last_user_authentication, |
191 MakeUserAgentForSyncapi().c_str()); | 192 MakeUserAgentForSyncapi().c_str()); |
192 DCHECK(success) << "Syncapi initialization failed!"; | 193 DCHECK(success) << "Syncapi initialization failed!"; |
193 } | 194 } |
194 | 195 |
195 void SyncBackendHost::Core::DoAuthenticate(const std::string& username, | 196 void SyncBackendHost::Core::DoAuthenticate(const std::string& username, |
196 const std::string& password) { | 197 const std::string& password, |
| 198 const std::string& captcha) { |
197 DCHECK(MessageLoop::current() == host_->core_thread_.message_loop()); | 199 DCHECK(MessageLoop::current() == host_->core_thread_.message_loop()); |
198 syncapi_->Authenticate(username.c_str(), password.c_str()); | 200 syncapi_->Authenticate(username.c_str(), password.c_str(), captcha.c_str()); |
199 } | 201 } |
200 | 202 |
201 void SyncBackendHost::Core::DoShutdown(bool sync_disabled) { | 203 void SyncBackendHost::Core::DoShutdown(bool sync_disabled) { |
202 DCHECK(MessageLoop::current() == host_->core_thread_.message_loop()); | 204 DCHECK(MessageLoop::current() == host_->core_thread_.message_loop()); |
203 | 205 |
204 save_changes_timer_.Stop(); | 206 save_changes_timer_.Stop(); |
205 syncapi_->Shutdown(); // Stops the SyncerThread. | 207 syncapi_->Shutdown(); // Stops the SyncerThread. |
206 syncapi_->RemoveObserver(); | 208 syncapi_->RemoveObserver(); |
207 host_->bookmark_model_worker_->OnSyncerShutdownComplete(); | 209 host_->bookmark_model_worker_->OnSyncerShutdownComplete(); |
208 | 210 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 save_changes_timer_.Start( | 286 save_changes_timer_.Start( |
285 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), | 287 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), |
286 this, &Core::SaveChanges); | 288 this, &Core::SaveChanges); |
287 } | 289 } |
288 | 290 |
289 void SyncBackendHost::Core::SaveChanges() { | 291 void SyncBackendHost::Core::SaveChanges() { |
290 syncapi_->SaveChanges(); | 292 syncapi_->SaveChanges(); |
291 } | 293 } |
292 | 294 |
293 } // namespace browser_sync | 295 } // namespace browser_sync |
OLD | NEW |