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

Unified Diff: sync/engine/net/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
« no previous file with comments | « sync/engine/net/server_connection_manager.h ('k') | sync/engine/syncer_proto_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/net/server_connection_manager.cc
diff --git a/sync/engine/net/server_connection_manager.cc b/sync/engine/net/server_connection_manager.cc
index 2d1d6c8bf0c3c8cd317fa616ed9c68f15d6b0354..5cac362461afb0a91240002d226bc85532a82293 100644
--- a/sync/engine/net/server_connection_manager.cc
+++ b/sync/engine/net/server_connection_manager.cc
@@ -10,7 +10,6 @@
#include <string>
#include <vector>
-#include "base/command_line.h"
#include "base/metrics/histogram.h"
#include "build/build_config.h"
#include "googleurl/src/gurl.h"
@@ -177,10 +176,12 @@ ScopedServerStatusWatcher::~ScopedServerStatusWatcher() {
ServerConnectionManager::ServerConnectionManager(
const string& server,
int port,
- bool use_ssl)
+ bool use_ssl,
+ bool use_oauth2_token)
: sync_server_(server),
sync_server_port_(port),
use_ssl_(use_ssl),
+ use_oauth2_token_(use_oauth2_token),
proto_sync_path_(kSyncServerSyncPath),
server_status_(HttpResponse::NONE),
terminated_(false),
@@ -213,12 +214,10 @@ void ServerConnectionManager::OnConnectionDestroyed(Connection* connection) {
active_connection_ = NULL;
}
-bool ServerConnectionManager::SetAuthToken(const std::string& auth_token,
- const base::Time& auth_token_time) {
+bool ServerConnectionManager::SetAuthToken(const std::string& auth_token) {
DCHECK(thread_checker_.CalledOnValidThread());
if (previously_invalidated_token != auth_token) {
auth_token_.assign(auth_token);
- auth_token_time_ = auth_token_time;
previously_invalidated_token = std::string();
return true;
}
@@ -226,18 +225,6 @@ bool ServerConnectionManager::SetAuthToken(const std::string& auth_token,
}
void ServerConnectionManager::OnInvalidationCredentialsRejected() {
- if (!auth_token_time_.is_null()) {
- base::TimeDelta age = base::Time::Now() - auth_token_time_;
- if (age < base::TimeDelta::FromHours(1)) {
- UMA_HISTOGRAM_CUSTOM_TIMES("Sync.AuthInvalidationRejectedTokenAgeShort",
- age,
- base::TimeDelta::FromSeconds(1),
- base::TimeDelta::FromHours(1),
- 50);
- }
- UMA_HISTOGRAM_COUNTS("Sync.AuthInvalidationRejectedTokenAgeLong",
- age.InDays());
- }
InvalidateAndClearAuthToken();
SetServerStatus(HttpResponse::SYNC_AUTH_ERROR);
}
@@ -248,7 +235,6 @@ void ServerConnectionManager::InvalidateAndClearAuthToken() {
if (!auth_token_.empty()) {
previously_invalidated_token.assign(auth_token_);
auth_token_ = std::string();
- auth_token_time_ = base::Time();
}
}
@@ -300,18 +286,6 @@ bool ServerConnectionManager::PostBufferToPath(PostBufferParams* params,
path.c_str(), auth_token, params->buffer_in, &params->response);
if (params->response.server_status == HttpResponse::SYNC_AUTH_ERROR) {
- if (!auth_token_time_.is_null()) {
- base::TimeDelta age = base::Time::Now() - auth_token_time_;
- if (age < base::TimeDelta::FromHours(1)) {
- UMA_HISTOGRAM_CUSTOM_TIMES("Sync.AuthServerRejectedTokenAgeShort",
- age,
- base::TimeDelta::FromSeconds(1),
- base::TimeDelta::FromHours(1),
- 50);
- }
- UMA_HISTOGRAM_COUNTS("Sync.AuthServerRejectedTokenAgeLong",
- age.InDays());
- }
InvalidateAndClearAuthToken();
}
« no previous file with comments | « sync/engine/net/server_connection_manager.h ('k') | sync/engine/syncer_proto_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698