Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 // This class serves as the single repository for cloud print auth tokens. This | 10 // This class serves as the single repository for cloud print auth tokens. This |
|
msw
2012/11/29 19:57:36
nit: move class comment down, just above the decl.
Chen Yu
2012/11/30 17:35:46
Done.
| |
| 11 // is only used within the CloudPrintProxyCoreThread. | 11 // is only used within the CloudPrintProxyCoreThread. |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 | 15 |
| 16 namespace cloud_print { | |
| 17 | |
| 16 class CloudPrintTokenStore : public base::NonThreadSafe { | 18 class CloudPrintTokenStore : public base::NonThreadSafe { |
| 17 public: | 19 public: |
| 18 // Returns the CloudPrintTokenStore instance for this thread. Will be NULL | 20 // Returns the CloudPrintTokenStore instance for this thread. Will be NULL |
| 19 // if no instance was created in this thread before. | 21 // if no instance was created in this thread before. |
| 20 static CloudPrintTokenStore* current(); | 22 static CloudPrintTokenStore* current(); |
| 21 | 23 |
| 22 CloudPrintTokenStore(); | 24 CloudPrintTokenStore(); |
| 23 ~CloudPrintTokenStore(); | 25 ~CloudPrintTokenStore(); |
| 24 | 26 |
| 25 void SetToken(const std::string& token); | 27 void SetToken(const std::string& token); |
| 26 std::string token() const { | 28 std::string token() const { |
| 27 DCHECK(CalledOnValidThread()); | 29 DCHECK(CalledOnValidThread()); |
| 28 return token_; | 30 return token_; |
| 29 } | 31 } |
| 30 | 32 |
| 31 private: | 33 private: |
| 32 std::string token_; | 34 std::string token_; |
| 33 | 35 |
| 34 DISALLOW_COPY_AND_ASSIGN(CloudPrintTokenStore); | 36 DISALLOW_COPY_AND_ASSIGN(CloudPrintTokenStore); |
| 35 }; | 37 }; |
| 36 | 38 |
| 39 } // namespace cloud_print | |
| 40 | |
| 37 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_TOKEN_STORE_H_ | 41 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_TOKEN_STORE_H_ |
| OLD | NEW |