summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/glue/sync_backend_host.cc
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 22:57:46 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 22:57:46 +0000
commit712257e6ca930697de2a5c1d5e0a4311262e5a2c (patch)
tree0da9814073776ad59689620f2b21716ec8d28e7f /chrome/browser/sync/glue/sync_backend_host.cc
parent4efb56d87a1927f4e497257805b54ad3bda87bec (diff)
downloadchromium_src-712257e6ca930697de2a5c1d5e0a4311262e5a2c.zip
chromium_src-712257e6ca930697de2a5c1d5e0a4311262e5a2c.tar.gz
chromium_src-712257e6ca930697de2a5c1d5e0a4311262e5a2c.tar.bz2
Part 1 of implementing captcha for sync dialog.
Added GoogleServiceAuthError, which is the same as the incumbent AuthErrorState but can support captcha information too. I moved it because it just had nothing specific to sync about it. This CL is mostly a rename and basic plumbing CaptchaRequired error state from browser_sync::AuthWatcher through to UI thread. Ben, I added a .h to chrome/browser/ alongside other google_* stuff. I'm just looking for your blessing here, or suggestion of alternate location. BUG=19738 Review URL: http://codereview.chromium.org/384040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/glue/sync_backend_host.cc')
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.cc30
1 files changed, 7 insertions, 23 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 523a30f..dcce1d4 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -20,6 +20,8 @@ static const char kGaiaSourceForChrome[] = "ChromiumBrowser";
static const FilePath::CharType kSyncDataFolderName[] =
FILE_PATH_LITERAL("Sync Data");
+typedef GoogleServiceAuthError AuthError;
+
namespace browser_sync {
SyncBackendHost::SyncBackendHost(SyncFrontend* frontend,
@@ -31,7 +33,7 @@ SyncBackendHost::SyncBackendHost(SyncFrontend* frontend,
frontend_(frontend),
processor_(processor),
sync_data_folder_path_(profile_path.Append(kSyncDataFolderName)),
- last_auth_error_(AUTH_ERROR_NONE) {
+ last_auth_error_(AuthError::None()) {
core_ = new Core(this);
}
@@ -125,7 +127,7 @@ string16 SyncBackendHost::GetAuthenticatedUsername() const {
return UTF8ToUTF16(core_->syncapi()->GetAuthenticatedUsername());
}
-AuthErrorState SyncBackendHost::GetAuthErrorState() const {
+const GoogleServiceAuthError& SyncBackendHost::GetAuthError() const {
return last_auth_error_;
}
@@ -214,23 +216,6 @@ void SyncBackendHost::Core::DoShutdown(bool sync_disabled) {
host_ = NULL;
}
-static AuthErrorState AuthProblemToAuthError(
- const sync_api::SyncManager::AuthProblem& auth_problem) {
- switch (auth_problem) {
- case sync_api::SyncManager::AUTH_PROBLEM_NONE:
- return AUTH_ERROR_NONE;
- case sync_api::SyncManager::AUTH_PROBLEM_INVALID_GAIA_CREDENTIALS:
- return AUTH_ERROR_INVALID_GAIA_CREDENTIALS;
- case sync_api::SyncManager::AUTH_PROBLEM_CONNECTION_FAILED:
- return AUTH_ERROR_CONNECTION_FAILED;
- case sync_api::SyncManager::AUTH_PROBLEM_USER_NOT_SIGNED_UP:
- return AUTH_ERROR_USER_NOT_SIGNED_UP;
- }
-
- NOTREACHED() << "Unknown AuthProblem.";
- return AUTH_ERROR_NONE;
-}
-
void SyncBackendHost::Core::OnChangesApplied(
const sync_api::BaseTransaction* trans,
const sync_api::SyncManager::ChangeRecord* changes,
@@ -276,17 +261,16 @@ void SyncBackendHost::Core::OnInitializationComplete() {
NewRunnableMethod(this, &Core::StartSavingChanges));
}
-void SyncBackendHost::Core::OnAuthProblem(
- sync_api::SyncManager::AuthProblem auth_problem) {
+void SyncBackendHost::Core::OnAuthError(const AuthError& auth_error) {
// We could be on SyncEngine_AuthWatcherThread. Post to our core loop so
// we can modify state.
host_->frontend_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &Core::HandleAuthErrorEventOnFrontendLoop,
- AuthProblemToAuthError(auth_problem)));
+ auth_error));
}
void SyncBackendHost::Core::HandleAuthErrorEventOnFrontendLoop(
- AuthErrorState new_auth_error) {
+ const GoogleServiceAuthError& new_auth_error) {
if (!host_ || !host_->frontend_)
return;