OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_TOKEN_STORE_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_TOKEN_STORE_H_ |
6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_TOKEN_STORE_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_TOKEN_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 // This class serves as the single repository for cloud print auth tokens. This | 11 // This class serves as the single repository for cloud print auth tokens. This |
12 // is only used within the CloudPrintProxyCoreThread. | 12 // is only used within the CloudPrintProxyCoreThread. |
13 | 13 |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
16 | 16 |
17 class CloudPrintTokenStore : public base::NonThreadSafe { | 17 class CloudPrintTokenStore : public base::NonThreadSafe { |
18 public: | 18 public: |
19 // Returns the CloudPrintTokenStore instance for this thread. Will be NULL | 19 // Returns the CloudPrintTokenStore instance for this thread. Will be NULL |
20 // if no instance was created in this thread before. | 20 // if no instance was created in this thread before. |
21 static CloudPrintTokenStore* current(); | 21 static CloudPrintTokenStore* current(); |
22 | 22 |
23 CloudPrintTokenStore(); | 23 CloudPrintTokenStore(); |
24 ~CloudPrintTokenStore(); | 24 ~CloudPrintTokenStore(); |
25 | 25 |
26 void SetToken(const std::string& token, bool is_oauth); | 26 void SetToken(const std::string& token); |
27 std::string token() const { | 27 std::string token() const { |
28 DCHECK(CalledOnValidThread()); | 28 DCHECK(CalledOnValidThread()); |
29 return token_; | 29 return token_; |
30 } | 30 } |
31 bool token_is_oauth() const { | |
32 DCHECK(CalledOnValidThread()); | |
33 return token_is_oauth_; | |
34 } | |
35 | 31 |
36 private: | 32 private: |
37 std::string token_; | 33 std::string token_; |
38 bool token_is_oauth_; | |
39 | 34 |
40 DISALLOW_COPY_AND_ASSIGN(CloudPrintTokenStore); | 35 DISALLOW_COPY_AND_ASSIGN(CloudPrintTokenStore); |
41 }; | 36 }; |
42 | 37 |
43 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_TOKEN_STORE_H_ | 38 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_TOKEN_STORE_H_ |
OLD | NEW |