| 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 GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 5 #ifndef GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
| 6 #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 6 #define GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/sequence_checker.h" |
| 14 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 15 #include "base/threading/non_thread_safe.h" | |
| 16 #include "google_apis/gaia/oauth2_token_service.h" | 16 #include "google_apis/gaia/oauth2_token_service.h" |
| 17 | 17 |
| 18 // OAuth2TokenServiceRequest represents an asynchronous request to an | 18 // OAuth2TokenServiceRequest represents an asynchronous request to an |
| 19 // OAuth2TokenService that may live in another thread. | 19 // OAuth2TokenService that may live in another thread. |
| 20 // | 20 // |
| 21 // An OAuth2TokenServiceRequest can be created and started from any thread. | 21 // An OAuth2TokenServiceRequest can be created and started from any thread. |
| 22 class OAuth2TokenServiceRequest : public OAuth2TokenService::Request, | 22 class OAuth2TokenServiceRequest : public OAuth2TokenService::Request { |
| 23 public base::NonThreadSafe { | |
| 24 public: | 23 public: |
| 25 class Core; | 24 class Core; |
| 26 | 25 |
| 27 // Interface for providing an OAuth2TokenService. | 26 // Interface for providing an OAuth2TokenService. |
| 28 // | 27 // |
| 29 // Ref-counted so that OAuth2TokenServiceRequest can ensure this object isn't | 28 // Ref-counted so that OAuth2TokenServiceRequest can ensure this object isn't |
| 30 // destroyed out from under the token service task runner thread. Because | 29 // destroyed out from under the token service task runner thread. Because |
| 31 // OAuth2TokenServiceRequest has a reference, implementations of | 30 // OAuth2TokenServiceRequest has a reference, implementations of |
| 32 // TokenServiceProvider must be capable of being destroyed on the same thread | 31 // TokenServiceProvider must be capable of being destroyed on the same thread |
| 33 // on which the OAuth2TokenServiceRequest was created. | 32 // on which the OAuth2TokenServiceRequest was created. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 std::string GetAccountId() const override; | 93 std::string GetAccountId() const override; |
| 95 | 94 |
| 96 private: | 95 private: |
| 97 OAuth2TokenServiceRequest(const std::string& account_id); | 96 OAuth2TokenServiceRequest(const std::string& account_id); |
| 98 | 97 |
| 99 void StartWithCore(const scoped_refptr<Core>& core); | 98 void StartWithCore(const scoped_refptr<Core>& core); |
| 100 | 99 |
| 101 const std::string account_id_; | 100 const std::string account_id_; |
| 102 scoped_refptr<Core> core_; | 101 scoped_refptr<Core> core_; |
| 103 | 102 |
| 103 SEQUENCE_CHECKER(sequence_checker_); |
| 104 |
| 104 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceRequest); | 105 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenServiceRequest); |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 #endif // GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ | 108 #endif // GOOGLE_APIS_GAIA_OAUTH2_TOKEN_SERVICE_REQUEST_H_ |
| OLD | NEW |