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

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: Remove token prefetch. Move UMA counters. Fix some tests. Etc. Created 7 years, 7 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/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..d5709a72ccdf06e12cc0e1540e7deff2ed271926 100644
--- a/sync/engine/net/server_connection_manager.cc
+++ b/sync/engine/net/server_connection_manager.cc
@@ -213,12 +213,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 +224,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",
Nicolas Zea 2013/06/04 20:13:59 Is this histogram completely unnecessary now?
pavely 2013/06/04 21:30:45 SetServerStatus(AuthError) will trigger PSS::OnCon
Nicolas Zea 2013/06/04 21:33:29 Note that this was a different histogram measuring
- 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 +234,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 +285,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();
}

Powered by Google App Engine
This is Rietveld 408576698