| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/gcm_driver/gcm_account_tracker.h" | 5 #include "components/gcm_driver/gcm_account_tracker.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include <algorithm> | 9 #include <algorithm> |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/bind.h" | 12 #include "base/bind.h" |
| 11 #include "base/location.h" | 13 #include "base/location.h" |
| 12 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 15 #include "components/gcm_driver/gcm_driver.h" | 17 #include "components/gcm_driver/gcm_driver.h" |
| 16 #include "google_apis/gaia/google_service_auth_error.h" | 18 #include "google_apis/gaia/google_service_auth_error.h" |
| 17 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 18 | 20 |
| 19 namespace gcm { | 21 namespace gcm { |
| 20 | 22 |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 // Scopes needed by the OAuth2 access tokens. | 25 // Scopes needed by the OAuth2 access tokens. |
| 24 const char kGCMGroupServerScope[] = "https://www.googleapis.com/auth/gcm"; | 26 const char kGCMGroupServerScope[] = "https://www.googleapis.com/auth/gcm"; |
| 25 const char kGCMCheckinServerScope[] = | 27 const char kGCMCheckinServerScope[] = |
| 26 "https://www.googleapis.com/auth/android_checkin"; | 28 "https://www.googleapis.com/auth/android_checkin"; |
| 27 // Name of the GCM account tracker for the OAuth2TokenService. | 29 // Name of the GCM account tracker for the OAuth2TokenService. |
| 28 const char kGCMAccountTrackerName[] = "gcm_account_tracker"; | 30 const char kGCMAccountTrackerName[] = "gcm_account_tracker"; |
| 29 // Minimum token validity when sending to GCM groups server. | 31 // Minimum token validity when sending to GCM groups server. |
| 30 const int64 kMinimumTokenValidityMs = 500; | 32 const int64_t kMinimumTokenValidityMs = 500; |
| 31 // Token reporting interval, when no account changes are detected. | 33 // Token reporting interval, when no account changes are detected. |
| 32 const int64 kTokenReportingIntervalMs = 12 * 60 * 60 * 1000; // 12 hours in ms. | 34 const int64_t kTokenReportingIntervalMs = |
| 35 12 * 60 * 60 * 1000; // 12 hours in ms. |
| 33 | 36 |
| 34 } // namespace | 37 } // namespace |
| 35 | 38 |
| 36 GCMAccountTracker::AccountInfo::AccountInfo(const std::string& email, | 39 GCMAccountTracker::AccountInfo::AccountInfo(const std::string& email, |
| 37 AccountState state) | 40 AccountState state) |
| 38 : email(email), state(state) { | 41 : email(email), state(state) { |
| 39 } | 42 } |
| 40 | 43 |
| 41 GCMAccountTracker::AccountInfo::~AccountInfo() { | 44 GCMAccountTracker::AccountInfo::~AccountInfo() { |
| 42 } | 45 } |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 iter->second.state = ACCOUNT_REMOVED; | 370 iter->second.state = ACCOUNT_REMOVED; |
| 368 ReportTokens(); | 371 ReportTokens(); |
| 369 } | 372 } |
| 370 | 373 |
| 371 OAuth2TokenService* GCMAccountTracker::GetTokenService() { | 374 OAuth2TokenService* GCMAccountTracker::GetTokenService() { |
| 372 DCHECK(account_tracker_->identity_provider()); | 375 DCHECK(account_tracker_->identity_provider()); |
| 373 return account_tracker_->identity_provider()->GetTokenService(); | 376 return account_tracker_->identity_provider()->GetTokenService(); |
| 374 } | 377 } |
| 375 | 378 |
| 376 } // namespace gcm | 379 } // namespace gcm |
| OLD | NEW |