Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Side by Side Diff: chrome/browser/sync/engine/authenticator.cc

Issue 2124020: Remove signin and persist from gaia_authenticator. (Closed)
Patch Set: final upload Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "chrome/browser/sync/engine/authenticator.h" 5 #include "chrome/browser/sync/engine/authenticator.h"
6 6
7 #include "chrome/browser/sync/engine/net/server_connection_manager.h" 7 #include "chrome/browser/sync/engine/net/server_connection_manager.h"
8 #include "chrome/browser/sync/engine/syncproto.h" 8 #include "chrome/browser/sync/engine/syncproto.h"
9 #include "chrome/browser/sync/protocol/sync.pb.h" 9 #include "chrome/browser/sync/protocol/sync.pb.h"
10 #include "chrome/browser/sync/util/user_settings.h" 10 #include "chrome/browser/sync/util/user_settings.h"
(...skipping 12 matching lines...) Expand all
23 Authenticator::Authenticator(ServerConnectionManager* manager) 23 Authenticator::Authenticator(ServerConnectionManager* manager)
24 : server_connection_manager_(manager), settings_(NULL) { 24 : server_connection_manager_(manager), settings_(NULL) {
25 } 25 }
26 26
27 Authenticator::AuthenticationResult Authenticator::Authenticate() { 27 Authenticator::AuthenticationResult Authenticator::Authenticate() {
28 // TODO(sync): Pull and work with saved credentials. 28 // TODO(sync): Pull and work with saved credentials.
29 return NO_SAVED_CREDENTIALS; 29 return NO_SAVED_CREDENTIALS;
30 } 30 }
31 31
32 Authenticator::AuthenticationResult Authenticator::Authenticate( 32 Authenticator::AuthenticationResult Authenticator::Authenticate(
33 string username, string password, bool save_credentials) { 33 string username, string password) {
34 // TODO(sync): need to figure out if this routine is used anywhere other 34 // TODO(sync): need to figure out if this routine is used anywhere other
35 // than the test code. 35 // than the test code.
36 gaia::GaiaAuthenticator auth_service("ChromiumBrowser", "chromiumsync", 36 gaia::GaiaAuthenticator auth_service("ChromiumBrowser", "chromiumsync",
37 "https://www.google.com:443/accounts/ClientLogin"); 37 "https://www.google.com:443/accounts/ClientLogin");
38 auth_service.set_message_loop(MessageLoop::current()); 38 auth_service.set_message_loop(MessageLoop::current());
39 const gaia::SignIn signin_type = 39 if (!auth_service.Authenticate(username, password)) {
40 settings_->RecallSigninType(username, gaia::GMAIL_SIGNIN);
41 if (!auth_service.Authenticate(username, password, gaia::SAVE_IN_MEMORY_ONLY,
42 signin_type)) {
43 return UNSPECIFIC_ERROR_RETURN; 40 return UNSPECIFIC_ERROR_RETURN;
44 } 41 }
45 CHECK(!auth_service.auth_token().empty()); 42 CHECK(!auth_service.auth_token().empty());
46 return AuthenticateToken(auth_service.auth_token()); 43 return AuthenticateToken(auth_service.auth_token());
47 } 44 }
48 45
49 COMPILE_ASSERT(sync_pb::ClientToServerResponse::ErrorType_MAX == 6, 46 COMPILE_ASSERT(sync_pb::ClientToServerResponse::ErrorType_MAX == 6,
50 client_to_server_response_errors_changed); 47 client_to_server_response_errors_changed);
51 48
52 Authenticator::AuthenticationResult Authenticator::HandleSuccessfulTokenRequest( 49 Authenticator::AuthenticationResult Authenticator::HandleSuccessfulTokenRequest(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // should never happen (only for stores). 99 // should never happen (only for stores).
103 case sync_pb::ClientToServerResponse::ACCESS_DENIED: 100 case sync_pb::ClientToServerResponse::ACCESS_DENIED:
104 default: 101 default:
105 LOG(ERROR) << "Corrupt Server packet received by auth, error code " << 102 LOG(ERROR) << "Corrupt Server packet received by auth, error code " <<
106 response.error_code(); 103 response.error_code();
107 return CORRUPT_SERVER_RESPONSE; 104 return CORRUPT_SERVER_RESPONSE;
108 } 105 }
109 } 106 }
110 107
111 } // namespace browser_sync 108 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/authenticator.h ('k') | chrome/browser/sync/engine/net/server_connection_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698