| 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 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_REFRESH_TOKEN_ANNOTATION_REQUEST_H_ | 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_REFRESH_TOKEN_ANNOTATION_REQUEST_H_ |
| 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_REFRESH_TOKEN_ANNOTATION_REQUEST_H_ | 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_REFRESH_TOKEN_ANNOTATION_REQUEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/threading/non_thread_safe.h" | 13 #include "base/sequence_checker.h" |
| 14 #include "google_apis/gaia/oauth2_api_call_flow.h" | 14 #include "google_apis/gaia/oauth2_api_call_flow.h" |
| 15 #include "google_apis/gaia/oauth2_token_service.h" | 15 #include "google_apis/gaia/oauth2_token_service.h" |
| 16 | 16 |
| 17 class PrefService; | 17 class PrefService; |
| 18 class SigninClient; | 18 class SigninClient; |
| 19 | 19 |
| 20 // RefreshTokenAnnotationRequest sends request to IssueToken endpoint with | 20 // RefreshTokenAnnotationRequest sends request to IssueToken endpoint with |
| 21 // device_id to backfill device info for refresh tokens issued pre-M38. It is | 21 // device_id to backfill device info for refresh tokens issued pre-M38. It is |
| 22 // important to keep server QPS low therefore this request is sent on average | 22 // important to keep server QPS low therefore this request is sent on average |
| 23 // once per 10 days per profile. | 23 // once per 10 days per profile. |
| 24 // This code shold be removed once majority of refresh tokens are updated. | 24 // This code shold be removed once majority of refresh tokens are updated. |
| 25 class RefreshTokenAnnotationRequest : public base::NonThreadSafe, | 25 class RefreshTokenAnnotationRequest : public OAuth2TokenService::Consumer, |
| 26 public OAuth2TokenService::Consumer, | |
| 27 public OAuth2ApiCallFlow { | 26 public OAuth2ApiCallFlow { |
| 28 public: | 27 public: |
| 29 ~RefreshTokenAnnotationRequest() override; | 28 ~RefreshTokenAnnotationRequest() override; |
| 30 | 29 |
| 31 // Checks if it's time to send IssueToken request. If it is then schedule | 30 // Checks if it's time to send IssueToken request. If it is then schedule |
| 32 // delay for next request and start request flow. | 31 // delay for next request and start request flow. |
| 33 // | 32 // |
| 34 // If request is started then return value is scoped_ptr to request. Callback | 33 // If request is started then return value is scoped_ptr to request. Callback |
| 35 // will be posted on current thread when request flow is finished one way or | 34 // will be posted on current thread when request flow is finished one way or |
| 36 // another. Callback's purpose is to delete request after it is done. | 35 // another. Callback's purpose is to delete request after it is done. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 const std::string& account_id); | 76 const std::string& account_id); |
| 78 | 77 |
| 79 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 78 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 80 std::string product_version_; | 79 std::string product_version_; |
| 81 std::string device_id_; | 80 std::string device_id_; |
| 82 std::string client_id_; | 81 std::string client_id_; |
| 83 base::Closure request_callback_; | 82 base::Closure request_callback_; |
| 84 | 83 |
| 85 std::unique_ptr<OAuth2TokenService::Request> access_token_request_; | 84 std::unique_ptr<OAuth2TokenService::Request> access_token_request_; |
| 86 | 85 |
| 86 SEQUENCE_CHECKER(sequence_checker_); |
| 87 |
| 87 DISALLOW_COPY_AND_ASSIGN(RefreshTokenAnnotationRequest); | 88 DISALLOW_COPY_AND_ASSIGN(RefreshTokenAnnotationRequest); |
| 88 }; | 89 }; |
| 89 | 90 |
| 90 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_REFRESH_TOKEN_ANNOTATION_REQUEST_H_ | 91 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_REFRESH_TOKEN_ANNOTATION_REQUEST_H_ |
| OLD | NEW |