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

Unified Diff: sync/internal_api/syncapi_server_connection_manager.cc

Issue 15421011: Use OAuth2 token for sync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 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 side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/syncapi_server_connection_manager.cc
diff --git a/sync/internal_api/syncapi_server_connection_manager.cc b/sync/internal_api/syncapi_server_connection_manager.cc
index 6b99ed16860a972efbd4ba86fc6d72612a6cd5d7..224d579a22a0a6b21c92dd30489a1def208946f3 100644
--- a/sync/internal_api/syncapi_server_connection_manager.cc
+++ b/sync/internal_api/syncapi_server_connection_manager.cc
@@ -31,15 +31,19 @@ bool SyncAPIBridgedConnection::Init(const char* path,
std::string sync_server;
int sync_server_port = 0;
bool use_ssl = false;
- GetServerParams(&sync_server, &sync_server_port, &use_ssl);
+ bool use_oauth2_token = false;
+ GetServerParams(&sync_server, &sync_server_port, &use_ssl, &use_oauth2_token);
std::string connection_url = MakeConnectionURL(sync_server, path, use_ssl);
HttpPostProviderInterface* http = post_provider_;
http->SetURL(connection_url.c_str(), sync_server_port);
if (!auth_token.empty()) {
- const std::string& headers =
- "Authorization: GoogleLogin auth=" + auth_token;
+ std::string headers;
+ if (use_oauth2_token)
+ headers = "Authorization: Bearer " + auth_token;
+ else
+ headers = "Authorization: GoogleLogin auth=" + auth_token;
http->SetExtraRequestHeaders(headers.c_str());
}
@@ -87,8 +91,9 @@ SyncAPIServerConnectionManager::SyncAPIServerConnectionManager(
const std::string& server,
int port,
bool use_ssl,
+ bool use_oauth2_token,
HttpPostProviderFactory* factory)
- : ServerConnectionManager(server, port, use_ssl),
+ : ServerConnectionManager(server, port, use_ssl, use_oauth2_token),
post_provider_factory_(factory) {
DCHECK(post_provider_factory_.get());
}
« no previous file with comments | « sync/internal_api/syncapi_server_connection_manager.h ('k') | sync/internal_api/syncapi_server_connection_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698