| 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 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // |processor|. | 80 // |processor|. |
| 81 SyncBackendHost(SyncFrontend* frontend, const FilePath& profile_path, | 81 SyncBackendHost(SyncFrontend* frontend, const FilePath& profile_path, |
| 82 ChangeProcessingInterface* processor); | 82 ChangeProcessingInterface* processor); |
| 83 ~SyncBackendHost(); | 83 ~SyncBackendHost(); |
| 84 | 84 |
| 85 // Called on |frontend_loop_| to kick off asynchronous initialization. | 85 // Called on |frontend_loop_| to kick off asynchronous initialization. |
| 86 void Initialize(const GURL& service_url, | 86 void Initialize(const GURL& service_url, |
| 87 URLRequestContextGetter* baseline_context_getter); | 87 URLRequestContextGetter* baseline_context_getter); |
| 88 | 88 |
| 89 // Called on |frontend_loop_| to kick off asynchronous authentication. | 89 // Called on |frontend_loop_| to kick off asynchronous authentication. |
| 90 void Authenticate(const std::string& username, const std::string& password); | 90 void Authenticate(const std::string& username, const std::string& password, |
| 91 const std::string& captcha); |
| 91 | 92 |
| 92 // Called on |frontend_loop_| to kick off shutdown. | 93 // Called on |frontend_loop_| to kick off shutdown. |
| 93 // |sync_disabled| indicates if syncing is being disabled or not. | 94 // |sync_disabled| indicates if syncing is being disabled or not. |
| 94 // See the implementation and Core::DoShutdown for details. | 95 // See the implementation and Core::DoShutdown for details. |
| 95 void Shutdown(bool sync_disabled); | 96 void Shutdown(bool sync_disabled); |
| 96 | 97 |
| 97 // Called on |frontend_loop_| to obtain a handle to the UserShare needed | 98 // Called on |frontend_loop_| to obtain a handle to the UserShare needed |
| 98 // for creating transactions. | 99 // for creating transactions. |
| 99 UserShareHandle GetUserShareHandle() const; | 100 UserShareHandle GetUserShareHandle() const; |
| 100 | 101 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // of the syncapi on behalf of SyncBackendHost::Initialize. | 162 // of the syncapi on behalf of SyncBackendHost::Initialize. |
| 162 void DoInitialize(const GURL& service_url, | 163 void DoInitialize(const GURL& service_url, |
| 163 BookmarkModelWorker* bookmark_model_worker, | 164 BookmarkModelWorker* bookmark_model_worker, |
| 164 bool attempt_last_user_authentication, | 165 bool attempt_last_user_authentication, |
| 165 sync_api::HttpPostProviderFactory* http_bridge_factory, | 166 sync_api::HttpPostProviderFactory* http_bridge_factory, |
| 166 sync_api::HttpPostProviderFactory* auth_http_bridge_factory); | 167 sync_api::HttpPostProviderFactory* auth_http_bridge_factory); |
| 167 | 168 |
| 168 // Called on our SyncBackendHost's core_thread_ to perform authentication | 169 // Called on our SyncBackendHost's core_thread_ to perform authentication |
| 169 // on behalf of SyncBackendHost::Authenticate. | 170 // on behalf of SyncBackendHost::Authenticate. |
| 170 void DoAuthenticate(const std::string& username, | 171 void DoAuthenticate(const std::string& username, |
| 171 const std::string& password); | 172 const std::string& password, |
| 173 const std::string& captcha); |
| 172 | 174 |
| 173 // The shutdown order is a bit complicated: | 175 // The shutdown order is a bit complicated: |
| 174 // 1) From |core_thread_|, invoke the syncapi Shutdown call to do a final | 176 // 1) From |core_thread_|, invoke the syncapi Shutdown call to do a final |
| 175 // SaveChanges, close sqlite handles, and halt the syncer thread (which | 177 // SaveChanges, close sqlite handles, and halt the syncer thread (which |
| 176 // could potentially block for 1 minute). | 178 // could potentially block for 1 minute). |
| 177 // 2) Then, from |frontend_loop_|, halt the core_thread_. This causes | 179 // 2) Then, from |frontend_loop_|, halt the core_thread_. This causes |
| 178 // syncapi thread-exit handlers to run and make use of cached pointers to | 180 // syncapi thread-exit handlers to run and make use of cached pointers to |
| 179 // various components owned implicitly by us. | 181 // various components owned implicitly by us. |
| 180 // 3) Destroy this Core. That will delete syncapi components in a safe order | 182 // 3) Destroy this Core. That will delete syncapi components in a safe order |
| 181 // because the thread that was using them has exited (in step 2). | 183 // because the thread that was using them has exited (in step 2). |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 285 |
| 284 // UI-thread cache of the last AuthErrorState received from syncapi. | 286 // UI-thread cache of the last AuthErrorState received from syncapi. |
| 285 GoogleServiceAuthError last_auth_error_; | 287 GoogleServiceAuthError last_auth_error_; |
| 286 | 288 |
| 287 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 289 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
| 288 }; | 290 }; |
| 289 | 291 |
| 290 } // namespace browser_sync | 292 } // namespace browser_sync |
| 291 | 293 |
| 292 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 294 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
| OLD | NEW |